Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Node.js EventEmitter implemented with CoffeeScript and jQuery
# Target:
class JQEvenEmitter
constructor: -> @_jq = jQuery {}
on: -> @_jq.bind.apply @_jq, arguments
addListener: JQEvenEmitter::on
once: -> @_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