timers: allow promisified timeouts/immediates to be canceled#33833
timers: allow promisified timeouts/immediates to be canceled#33833jasnell wants to merge 1 commit intonodejs:masterfrom
Conversation
|
I like this. However I think it's time we design a few new apis for I do On a technical side this would have the benefit of avoiding to call |
|
I've been considered exporting the promisified versions of const {
setTimeout,
setImmediate
} = require('timers/promises');I'm also considering a promisified version of const {
setInterval,
} = require('timers/promises');
(async () => {
for await (const n of setInterval(1000)) {
console.log('tick...')
}
})()We also need to consider how to ref/unref promisified timers/intervals/immediates. |
60ee29c to
129a5c2
Compare
|
@mcollina ... I will introduce |
Using the new experimental AbortController... Signed-off-by: James M Snell <[email protected]>
28e3e65 to
b2e0153
Compare
Using the new experimental AbortController... Signed-off-by: James M Snell <[email protected]> PR-URL: #33833 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Gus Caplan <[email protected]>
|
Landed in bfbdc84 |
|
Marking |
Using the new experimental AbortController... Signed-off-by: James M Snell <[email protected]> PR-URL: nodejs#33833 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Gus Caplan <[email protected]>
Using the new experimental AbortController... Signed-off-by: James M Snell <[email protected]> PR-URL: nodejs#33833 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Gus Caplan <[email protected]>
Using the new experimental AbortController... Signed-off-by: James M Snell <[email protected]> PR-URL: nodejs#33833 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Gus Caplan <[email protected]>
Using the new experimental AbortController... Signed-off-by: James M Snell <[email protected]> PR-URL: #33833 Backport-PR-URL: #38386 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Gus Caplan <[email protected]>
Using the new experimental AbortController...
This will necessarily be experimental for as long as
AbortControlleris experimental.Signed-off-by: James M Snell [email protected]
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes