Created
December 1, 2011 08:06
-
-
Save jackey/1414846 to your computer and use it in GitHub Desktop.
process.nextTick
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var MyConstructor = function() { | |
... | |
process.nextTick(function() { | |
self._continue(); | |
}); | |
}; | |
MyConstructor.prototype.__proto__ = EventEmitter.prototype; | |
MyConstructor.prototype._continue = function() { | |
// without the process.nextTick | |
// these events would be emitted immediately | |
// with no listeners. they would be lost. | |
this.emit('data', 'hello'); | |
this.emit('data', 'world'); | |
this.emit('end'); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment