-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
timers: allow promisified timeouts/immediates to be canceled #33833
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
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
AbortController
is experimental.Signed-off-by: James M Snell jasnell@gmail.com
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes