Skip to content

Instantly share code, notes, and snippets.

View demux's full-sized avatar

Arnar Yngvason demux

  • Reykjavík, Iceland
View GitHub Profile
class SimpleEventEmitter:
_events: []
_onceWrapper: (type) ->
wrapper = ~>
@off(type, wrapper)
fn.apply(this, arguments)
on: (type, fn, once=false) !->
@_events[type] = @_events[type]? or []