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