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

Commit 28eeef7e by Sascha Depold

moved tick method to utils

1 parent b95c33ea
...@@ -2,7 +2,6 @@ var util = require("util") ...@@ -2,7 +2,6 @@ var util = require("util")
, EventEmitter = require("events").EventEmitter , EventEmitter = require("events").EventEmitter
, Promise = require("promise") , Promise = require("promise")
, proxyEventKeys = ['success', 'error', 'sql'] , proxyEventKeys = ['success', 'error', 'sql']
, tick = (typeof setImmediate !== "undefined" ? setImmediate : process.nextTick)
, Utils = require('../utils') , Utils = require('../utils')
var bindToProcess = function(fct) { var bindToProcess = function(fct) {
...@@ -20,7 +19,7 @@ module.exports = (function() { ...@@ -20,7 +19,7 @@ module.exports = (function() {
util.inherits(CustomEventEmitter, EventEmitter) util.inherits(CustomEventEmitter, EventEmitter)
CustomEventEmitter.prototype.run = function() { CustomEventEmitter.prototype.run = function() {
tick(function() { Utils.tick(function() {
if (this.fct) { if (this.fct) {
this.fct.call(this, this) this.fct.call(this, this)
} }
......
...@@ -494,6 +494,11 @@ var Utils = module.exports = { ...@@ -494,6 +494,11 @@ var Utils = module.exports = {
return now return now
}, },
tick: function(func) {
var tick = (typeof setImmediate !== "undefined" ? setImmediate : process.nextTick)
tick(func)
},
// Note: Use the `quoteIdentifier()` and `escape()` methods on the // Note: Use the `quoteIdentifier()` and `escape()` methods on the
// `QueryInterface` instead for more portable code. // `QueryInterface` instead for more portable code.
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!