public
Created

Node.js EventEmitter implemented with CoffeeScript and jQuery

  • Download Gist
jqeventemitter.coffee
CoffeeScript
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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.