5 ms·
Is there some other way to do that except process.nextTick() and queueMicroTask()? https://nodejs.org/api/process.html#processnexttickcallback-args https://nod
by eurasiantiger 4y ago
Is there some other way to do that except process.nextTick() and queueMicroTask()?
https://nodejs.org/api/process.html#processnexttickcallback-args https://nodejs.org/api/process.html#processnexttickcallback-...
> It is very important for APIs to be either 100% synchronous or 100% asynchronous.
As I understand, this implementation sidesteps this hazard by providing separate internally coupled sync/async APIs kept in sync by convention around the critical internal and external conditionals. Is this correct? Is it just this sync/async code path convention that makes the implementation safe as opposed to a function directly returning a value or a Promise?
The convention does make it kludgy to use, but native alternatives would defeat the purpose or become the hazard mentioned in the documentation.
Have you considered creating a Babel macro for this?