From feff67457d8111a49cba62cfa09101cf55a84ced Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 24 Oct 2013 18:43:22 -0700 Subject: [PATCH] :non-potable_water: Include namespace when canceling subscription Emissary does not clear our namespace listeners when calling off with only the event name and the handler. --- src/config.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/config.coffee b/src/config.coffee index 18cbf2692..02ada675d 100644 --- a/src/config.coffee +++ b/src/config.coffee @@ -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