Pass previous value to the callback in config.observe()

This commit is contained in:
Ben Ogle
2013-10-21 15:46:37 -07:00
parent 73c1fb23da
commit dd3b20f7de

View File

@@ -207,8 +207,9 @@ class Config
updateCallback = =>
value = @get(keyPath)
unless _.isEqual(value, previousValue)
previous = previousValue
previousValue = _.clone(value)
callback(value)
callback(value, {previous})
subscription = { cancel: => @off 'updated', updateCallback }
@on 'updated', updateCallback