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

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 5 additions and 4 deletions
......@@ -6,9 +6,9 @@ var util = require("util")
var bindToProcess = function(fct) {
if (fct) {
if(process.domain) {
return process.domain.bind(fct);
}
if (process.domain) {
return process.domain.bind(fct);
}
}
return fct;
......@@ -21,7 +21,8 @@ module.exports = (function() {
util.inherits(CustomEventEmitter, EventEmitter)
CustomEventEmitter.prototype.run = function() {
process.nextTick(function() {
var tick = (typeof setImmediate !== "undefined" ? setImmediate : process.nextTick)
tick(function() {
if (this.fct) {
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!