Skip to content
Browse files

use setImmediate() on node 0.10.x

  • Loading branch information...
1 parent 8366943 commit e8d321e8929794395c6a540f31765f848452d630 @carlos8f committed Mar 11, 2013
Showing with 10 additions and 2 deletions.
  1. +1 −0 .travis.yml
  2. +9 −2 index.js
View
1 .travis.yml
@@ -2,3 +2,4 @@ language: node_js
node_js:
- 0.6
- 0.8
+ - 0.10
View
11 index.js
@@ -130,7 +130,7 @@ function queue (fn) {
}
function doQueue () {
- process.nextTick(function () {
+ function _doQueue () {
if (!relations.store) {
relations.use(relations.stores.memory);
}
@@ -139,5 +139,12 @@ function doQueue () {
relations.store.invoke(cmd.type, cmd, cmd.fn);
}
if (relations._queue.length) doQueue();
- });
+ }
+
+ if (typeof setImmediate !== 'undefined') {
+ setImmediate(_doQueue);
+ }
+ else {
+ process.nextTick(_doQueue);
+ }
}

0 comments on commit e8d321e

Please sign in to comment.
Something went wrong with that request. Please try again.