Skip to content
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

doc: recommend queueMicrotask over process.nextTick #37484

Closed
wants to merge 1 commit into from

Conversation

jasnell
Copy link
Member

@jasnell jasnell commented Feb 22, 2021

We likely cannot ever deprecate process.nextTick, but we can start
steering people towards queueMicrotask for most cases.

Signed-off-by: James M Snell [email protected]
Fixes: #36870

@nodejs-github-bot nodejs-github-bot added doc Issues and PRs related to the documentations. process Issues and PRs related to the process subsystem. labels Feb 22, 2021
doc/api/process.md Outdated Show resolved Hide resolved
@mscdex
Copy link
Contributor

mscdex commented Feb 23, 2021

I think one obvious (and probably note-worthy) incompatibility compared to process.nextTick() is that you cannot pass values to the callback, something node core takes advantage of extensively for convenience and performance.

@jasnell
Copy link
Member Author

jasnell commented Feb 23, 2021

I think one obvious (and probably note-worthy) incompatibility compared to process.nextTick() is that you cannot pass values to the callback, something node core takes advantage of extensively for convenience and performance.

Good point and definitely worth adding.

@Delapouite
Copy link
Contributor

Should queueMicrotask be also mentioned in this documentation page about the event loop: https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/ ?

doc/api/process.md Outdated Show resolved Hide resolved
We likely cannot ever deprecate process.nextTick, but we can start
steering people towards queueMicrotask for most cases.

Signed-off-by: James M Snell <[email protected]>
Fixes: nodejs#36870
@jasnell
Copy link
Member Author

jasnell commented Feb 23, 2021

@Delapouite ... yes, but that's a separate change.

@jasnell jasnell added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Feb 23, 2021
ronag added a commit to nodejs/undici that referenced this pull request Feb 24, 2021
@jasnell
Copy link
Member Author

jasnell commented Feb 25, 2021

Landed in ee6c467

@jasnell jasnell closed this Feb 25, 2021
jasnell added a commit that referenced this pull request Feb 25, 2021
We likely cannot ever deprecate process.nextTick, but we can start
steering people towards queueMicrotask for most cases.

Signed-off-by: James M Snell <[email protected]>
Fixes: #36870

PR-URL: #37484
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: Robert Nagy <[email protected]>
targos pushed a commit that referenced this pull request Feb 28, 2021
We likely cannot ever deprecate process.nextTick, but we can start
steering people towards queueMicrotask for most cases.

Signed-off-by: James M Snell <[email protected]>
Fixes: #36870

PR-URL: #37484
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: Robert Nagy <[email protected]>
targos pushed a commit that referenced this pull request May 1, 2021
We likely cannot ever deprecate process.nextTick, but we can start
steering people towards queueMicrotask for most cases.

Signed-off-by: James M Snell <[email protected]>
Fixes: #36870

PR-URL: #37484
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: Robert Nagy <[email protected]>
@danielleadams danielleadams mentioned this pull request May 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. doc Issues and PRs related to the documentations. process Issues and PRs related to the process subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate process.nextTick in favor of queueMicrotask
8 participants