Commit 401154b7 authored by Nick Stenning's avatar Nick Stenning

Use class.coffee from upstream

parent 3ec977f3
......@@ -37,6 +37,12 @@ class Delegator
this.on = this.subscribe
this.addEvents()
# Public: Destroy the instance, unbinding all events.
#
# Returns nothing.
destroy: ->
this.removeEvents()
# Public: binds the function names in the @events Object to their events.
#
# The @events Object should be a set of key/value pairs where the key is the
......@@ -99,11 +105,7 @@ class Delegator
#
# Returns itself.
_addEvent: (selector, event, functionName) ->
f = if typeof functionName is 'string'
this[functionName]
else
functionName
closure = => f.apply(this, arguments)
closure = => this[functionName].apply(this, arguments)
if selector == '' and Delegator._isCustomEvent(event)
this.subscribe(event, closure)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment