不要怂,就是干,撸起袖子干!

Commit bbd36fe2 by Daniel Durante

Custom event emitter uses setImmediate over process.nextTick if supported. Close…

…s https://github.com/sequelize/sequelize/issues/869
1 parent 3a46e499
Showing with 3 additions and 2 deletions
...@@ -6,7 +6,7 @@ var util = require("util") ...@@ -6,7 +6,7 @@ var util = require("util")
var bindToProcess = function(fct) { var bindToProcess = function(fct) {
if (fct) { if (fct) {
if(process.domain) { if (process.domain) {
return process.domain.bind(fct); return process.domain.bind(fct);
} }
} }
...@@ -21,7 +21,8 @@ module.exports = (function() { ...@@ -21,7 +21,8 @@ module.exports = (function() {
util.inherits(CustomEventEmitter, EventEmitter) util.inherits(CustomEventEmitter, EventEmitter)
CustomEventEmitter.prototype.run = function() { CustomEventEmitter.prototype.run = function() {
process.nextTick(function() { var tick = (typeof setImmediate !== "undefined" ? setImmediate : process.nextTick)
tick(function() {
if (this.fct) { if (this.fct) {
this.fct.call(this, this) this.fct.call(this, this)
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!