-
Notifications
You must be signed in to change notification settings - Fork 30k
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 <[email protected]>
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 <[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
AbortController
is experimental.Signed-off-by: James M Snell [email protected]
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes