Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Node.js EventEmitter implemented with CoffeeScript and jQuery

View jqeventemitter.coffee
1 2 3 4 5 6 7 8 9 10 11 12 13 14
# 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.