From 125849673a1aba46021852ee473d00f4520d1bd6 Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Tue, 11 Dec 2018 20:36:55 +0900 Subject: Use for-of instead of forEach (#3583) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: syuilo Co-authored-by: Acid Chicken (硫酸鶏) --- src/client/app/common/scripts/check-for-update.ts | 7 ++++--- src/client/app/common/scripts/stream.ts | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src/client/app/common/scripts') diff --git a/src/client/app/common/scripts/check-for-update.ts b/src/client/app/common/scripts/check-for-update.ts index e8a5d18f09..20da83a0c2 100644 --- a/src/client/app/common/scripts/check-for-update.ts +++ b/src/client/app/common/scripts/check-for-update.ts @@ -14,9 +14,10 @@ export default async function($root: any, force = false, silent = false) { navigator.serviceWorker.controller.postMessage('clear'); } - navigator.serviceWorker.getRegistrations().then(registrations => { - registrations.forEach(registration => registration.unregister()); - }); + const registrations = await navigator.serviceWorker.getRegistrations(); + for (const registration of registrations) { + registration.unregister(); + } } catch (e) { console.error(e); } diff --git a/src/client/app/common/scripts/stream.ts b/src/client/app/common/scripts/stream.ts index 80278a76f6..23f839ae85 100644 --- a/src/client/app/common/scripts/stream.ts +++ b/src/client/app/common/scripts/stream.ts @@ -111,9 +111,9 @@ export default class Stream extends EventEmitter { connections = [this.nonSharedConnections.find(c => c.id === id)]; } - connections.filter(c => c != null).forEach(c => { + for (const c of connections.filter(c => c != null)) { c.emit(body.type, body.body); - }); + } } else { this.emit(type, body); } -- cgit v1.2.3-freya