diff options
| author | Aya Morisawa <AyaMorisawa4869@gmail.com> | 2018-12-11 20:36:55 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-12-11 20:36:55 +0900 |
| commit | 125849673a1aba46021852ee473d00f4520d1bd6 (patch) | |
| tree | e30d39490236df402b97a9963dafa44eaf549368 /src/client/app/common/scripts | |
| parent | Fix error (diff) | |
| download | sharkey-125849673a1aba46021852ee473d00f4520d1bd6.tar.gz sharkey-125849673a1aba46021852ee473d00f4520d1bd6.tar.bz2 sharkey-125849673a1aba46021852ee473d00f4520d1bd6.zip | |
Use for-of instead of forEach (#3583)
Co-authored-by: syuilo <syuilotan@yahoo.co.jp>
Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
Diffstat (limited to 'src/client/app/common/scripts')
| -rw-r--r-- | src/client/app/common/scripts/check-for-update.ts | 7 | ||||
| -rw-r--r-- | src/client/app/common/scripts/stream.ts | 4 |
2 files changed, 6 insertions, 5 deletions
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); } |