Open this example in the interactive library
Source code
import {
setTimeout as delay,
setImmediate as immediate,
} from "node:timers/promises";
console.log(
await (async () => {
const signal = AbortSignal.timeout(1);
await delay(5);
return signal.aborted;
})(),
);
Sample output
true
