diff options
author | Graeme Yeates <yeatesgraeme@gmail.com> | 2015-12-23 15:50:39 -0500 |
---|---|---|
committer | Graeme Yeates <yeatesgraeme@gmail.com> | 2015-12-29 16:48:48 -0500 |
commit | 18e61d4f07f48604601f2effdbe2a7e188d14d4a (patch) | |
tree | d4761428f57ec80816bea109124fd836cdaf20a6 /lib/internal/setImmediate.js | |
parent | 7127b67f94a22247c36bf40e4f2685912e0f80e9 (diff) | |
download | async-18e61d4f07f48604601f2effdbe2a7e188d14d4a.tar.gz |
[WIP] modularization (#984)
Diffstat (limited to 'lib/internal/setImmediate.js')
-rw-r--r-- | lib/internal/setImmediate.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/internal/setImmediate.js b/lib/internal/setImmediate.js new file mode 100644 index 0000000..d44c66e --- /dev/null +++ b/lib/internal/setImmediate.js @@ -0,0 +1,17 @@ +var _setImmediate = typeof setImmediate === 'function' && setImmediate; + +var _delay; +if (_setImmediate) { + _delay = function(fn) { + // not a direct alias for IE10 compatibility + _setImmediate(fn); + } +} else if (typeof process === 'object' && typeof process.nextTick === 'function') { + _delay = process.nextTick; +} else { + _delay = function(fn) { + setTimeout(fn, 0); + }; +} + +export default _delay; |