summaryrefslogtreecommitdiff
path: root/lib/internal/setImmediate.js
diff options
context:
space:
mode:
authorGraeme Yeates <yeatesgraeme@gmail.com>2015-12-23 15:50:39 -0500
committerGraeme Yeates <yeatesgraeme@gmail.com>2015-12-29 16:48:48 -0500
commit18e61d4f07f48604601f2effdbe2a7e188d14d4a (patch)
treed4761428f57ec80816bea109124fd836cdaf20a6 /lib/internal/setImmediate.js
parent7127b67f94a22247c36bf40e4f2685912e0f80e9 (diff)
downloadasync-18e61d4f07f48604601f2effdbe2a7e188d14d4a.tar.gz
[WIP] modularization (#984)
Diffstat (limited to 'lib/internal/setImmediate.js')
-rw-r--r--lib/internal/setImmediate.js17
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;