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

Commit bccce1d4 by Mick Hansen

CustomEventEmitter.proxy method, proxies events from one emitter to another

1 parent b92165ec
...@@ -5,3 +5,4 @@ test*.js ...@@ -5,3 +5,4 @@ test*.js
node_modules node_modules
npm-debug.log npm-debug.log
*~ *~
.jshintrc
\ No newline at end of file
...@@ -40,6 +40,15 @@ module.exports = (function() { ...@@ -40,6 +40,15 @@ module.exports = (function() {
return this return this
} }
CustomEventEmitter.prototype.proxy = function(emitter) {
this.on('error', function (err) {
emitter.emit('error', err)
})
this.on('success', function (result) {
emitter.emit('success', result)
})
}
return CustomEventEmitter; return CustomEventEmitter;
})() })()
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!