dockerized_openAger/nodered/rootfs/data/node_modules/asynckit/lib/defer.js

27 lines
441 B
JavaScript
Raw Permalink Normal View History

2020-10-17 16:42:50 +00:00
module.exports = defer;
/**
* Runs provided function on next iteration of the event loop
*
* @param {function} fn - function to run
*/
function defer(fn)
{
var nextTick = typeof setImmediate == 'function'
? setImmediate
: (
typeof process == 'object' && typeof process.nextTick == 'function'
? process.nextTick
: null
);
if (nextTick)
{
nextTick(fn);
}
else
{
setTimeout(fn, 0);
}
}