Permalink
Browse files

Use setImmediate where available instead of nextTick.

  • Loading branch information...
1 parent f576cab commit 4a0f216fb4e8471b575c36fc5e516b1d20809eab Chakrit Wichian committed Jul 22, 2013
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/jam.js
View
@@ -2,8 +2,12 @@
// lib/jam.js - Main JAM entrypoint
module.exports = (function() {
- var assert = require('assert')
- , tick = process.nextTick;
+ var assert = require('assert'), tick = null;
+
+ // find out what is our best option for next tick
+ tick = setImmediate || (process && process.nextTick) || function(func) {
+ setTimeout(func, 0);
+ };
// # INTERNAL HELPERS

0 comments on commit 4a0f216

Please sign in to comment.