graceful.js
This file
Path
test/helpers/graceful.js
8 lines · 277 bytes · JavaScript
Last changed by
Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5
History of this fileTake it
Add `gracefulCancel` option (#1109)ehmickybefore adoptiond8190e5
lines 1–8why, one step back1import {setTimeout} from 'node:timers/promises';23// Combines `util.aborted()` and `events.addAbortListener()`: promise-based and cleaned up with a stop signal4export const onAbortedSignal = async signal => {5 try {6 await setTimeout(1e8, undefined, {signal});7 } catch {}8};