Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/shared/enqueueTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@
let didWarnAboutMessageChannel = false;
let enqueueTaskImpl = null;

/**
* Enqueues a task to be executed asynchronously.
*
* In Node.js environments, this uses `setImmediate` to bypass fake timers.
* In browser environments, this uses `MessageChannel` to ensure the task
* runs asynchronously even when timers are faked (e.g., in tests).
*
* @param {() => void} task - The function to execute asynchronously.
* @returns {void}
*/
export default function enqueueTask(task: () => void): void {
if (enqueueTaskImpl === null) {
try {
Expand Down
2 changes: 1 addition & 1 deletion scripts/error-codes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ provide a better debugging support in production. Check out the blog post

- [`codes.json`](https://github.com/facebook/react/blob/main/scripts/error-codes/codes.json)
contains the mapping from IDs to error messages. This file is generated by the
Gulp plugin and is used by both the Babel plugin and the error decoder page in
`extract-errors.js` script and is used by both the Babel plugin and the error decoder page in
our documentation. This file is append-only, which means an existing code in
the file will never be changed/removed.
- [`extract-errors.js`](https://github.com/facebook/react/blob/main/scripts/error-codes/extract-errors.js)
Expand Down