diff options
author | Marcos Casagrande <marcoscvp90@gmail.com> | 2020-06-07 15:23:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-07 09:23:52 -0400 |
commit | 62adc63934d8be52b90512ad0e8165d9dd36eafc (patch) | |
tree | 302c0214dd8d5489c4ccebe8772904b889a3d7f7 | |
parent | 7b597c82fcef827b05c8fa599c6d29f55af18fed (diff) |
refactor(std/signal): Replace setTimeout with IIFE (#6153)
-rw-r--r-- | std/signal/mod.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/std/signal/mod.ts b/std/signal/mod.ts index c15d1b326..f09f76882 100644 --- a/std/signal/mod.ts +++ b/std/signal/mod.ts @@ -61,12 +61,12 @@ export function signal( export function onSignal(signo: number, callback: () => void): Disposable { const sig = signal(signo); - //setTimeout allows `sig` to be returned before blocking on the await - setTimeout(async () => { + // allows `sig` to be returned before blocking on the await + (async (): Promise<void> => { for await (const _ of sig) { callback(); } - }, 0); + })(); return sig; } |