diff options
Diffstat (limited to 'includes/external/addressbook/node_modules/asynckit/lib/defer.js')
-rw-r--r-- | includes/external/addressbook/node_modules/asynckit/lib/defer.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/includes/external/addressbook/node_modules/asynckit/lib/defer.js b/includes/external/addressbook/node_modules/asynckit/lib/defer.js new file mode 100644 index 0000000..b67110c --- /dev/null +++ b/includes/external/addressbook/node_modules/asynckit/lib/defer.js @@ -0,0 +1,26 @@ +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); + } +} |