diff options
| author | Yoshiya Hinosawa <stibium121@gmail.com> | 2019-07-28 20:35:47 +0900 |
|---|---|---|
| committer | Ryan Dahl <ry@tinyclouds.org> | 2019-07-28 11:35:47 +0000 |
| commit | 44efefbda6d30edc602257c1a2501259e7ef9626 (patch) | |
| tree | 6d2286defcba5e9d10db395a1ab272581b75165c /util | |
| parent | ad6360edf9a072fdb393ddb59036ba8bb4dae25e (diff) | |
Ignore error of writing responses to aborted requests (denoland/deno_std#546)
Original: https://github.com/denoland/deno_std/commit/826deb1012d3595c3f6de19659e13564a15ceda1
Diffstat (limited to 'util')
| -rw-r--r-- | util/async.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/util/async.ts b/util/async.ts index b737c4cc8..01df39cc8 100644 --- a/util/async.ts +++ b/util/async.ts @@ -108,3 +108,13 @@ export async function collectUint8Arrays( } return collected; } + +// Delays the given milliseconds and resolves. +export function delay(ms: number): Promise<void> { + return new Promise( + (res): number => + setTimeout((): void => { + res(); + }, ms) + ); +} |
