Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Node.js EventEmitter implemented with CoffeeScript and jQuery
# 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
Something went wrong with that request. Please try again.