You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
process.nextTick() will be processed after the current operation is completed, regardless of current phase of the event loop.
159
-
Operation is defined as a transition from the underlying C/C++ handler, and handling the JavaScript that needs to be executed.
160
-
161
-
* process.nextTick() fires immediately on the same phase
162
-
* setImmediate() fires on the following iteration or 'tick' of the event loop
158
+
* process.nextTick() will be processed after the current operation is completed, regardless of current phase of the event loop.
159
+
* Operation is defined as a transition from the underlying C/C++ handler, and handling the JavaScript that needs to be executed.
160
+
* It schedules a callback function to be executed immediately after the current operation completes, but before the event loop proceeds to the next phase.
163
161
164
162
**Why use process.nextTick()?**
165
163
166
164
* Allow users to handle errors, cleanup unneeded resources, or try the request again before the event loop continues.
167
165
* At times to allow a callback to run after the call stack has unwound but before the event loop continues.
168
166
167
+
**process.nextTick() vs setImmediate()**
168
+
* process.nextTick() fires immediately on the same phase
169
+
* setImmediate() fires on the following iteration or 'tick' of the event loop
0 commit comments