🚱 Include namespace when canceling subscription

Emissary does not clear our namespace listeners when calling off
with only the event name and the handler.
This commit is contained in:
Kevin Sawicki 2013-10-24 18:43:22 -07:00
parent 3e584f29b1
commit feff67457d

View File

@ -211,12 +211,12 @@ class Config
previousValue = _.clone(value)
callback(value, {previous})
subscription = { cancel: => @off 'updated', updateCallback }
@on "updated.#{keyPath.replace(/\./, '-')}", updateCallback
eventName = "updated.#{keyPath.replace(/\./, '-')}"
subscription = { cancel: => @off eventName, updateCallback }
@on eventName, updateCallback
callback(value) if options.callNow ? true
subscription
# Public: Unobserve all callbacks on a given key
#
# keyPath - The {String} name of the key to unobserve