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 <jasnell@gmail.com>
28e3e65 to
b2e0153
Compare
Using the new experimental AbortController... Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: #33833 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
|
Landed in bfbdc84 |
|
Marking |
Using the new experimental AbortController... Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: nodejs#33833 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
Using the new experimental AbortController... Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: nodejs#33833 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
Using the new experimental AbortController... Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: nodejs#33833 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
Using the new experimental AbortController...
This will necessarily be experimental for as long as
AbortControlleris experimental.Signed-off-by: James M Snell jasnell@gmail.com
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes