Created
June 17, 2011 21:03
-
-
Save esamattis/1032342 to your computer and use it in GitHub Desktop.
Node.js EventEmitter implemented with CoffeeScript and jQuery
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
# Target: http://nodejs.org/docs/v0.4.8/api/events.html | |
class JQEvenEmitter | |
constructor: -> @_jq = jQuery {} | |
on: -> @_jq.bind.apply @_jq, arguments | |
addListener: JQEvenEmitter::on | |
once: -> @_jq.one.apply @_jq, arguments | |
removeListener: -> @_jq.unbind.apply @_jq, arguments | |
removeAllListeners: JQEvenEmitter::removeListener | |
emit: -> @_jq.trigger.apply @_jq, arguments | |
# Missing only setMaxListeners and listeners array |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment