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
123456789import {setTimeout} from 'node:timers/promises';
// Combines `util.aborted()` and `events.addAbortListener()`: promise-based and cleaned up with a stop signalexport const onAbortedSignal = async signal => { try { await setTimeout(1e8, undefined, {signal}); } catch {}};