You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
478 B
18 lines
478 B
if (typeof process === 'object' && process.nextTick && !false) {
|
|
exports = process.nextTick;
|
|
} else if (typeof setImmediate === 'function') {
|
|
exports = function(cb) {
|
|
setImmediate(ensureCallable(cb));
|
|
};
|
|
} else {
|
|
exports = function(cb) {
|
|
setTimeout(ensureCallable(cb), 0);
|
|
};
|
|
}
|
|
function ensureCallable(fn) {
|
|
if (typeof fn !== 'function')
|
|
throw new TypeError(fn + ' is not a function');
|
|
return fn;
|
|
}
|
|
|
|
module.exports = exports;
|
|
|