27bc80be by Michael Richards

Add a way to publish a change to a keypath (only goes through when resolvable).

1 parent 94ecb4ea
......@@ -70,7 +70,7 @@ class Rivets.Binding
if @view.formatters[id]?.publish
value = @view.formatters[id].publish value, args...
@observer.setValue value
@observer.publish value
# Subscribes to the model for changes at the specified keypath. Bi-directional
# routines will also listen for changes on the element to propagate them back
......
......@@ -49,6 +49,10 @@ class Rivets.Observer
read: (key, obj) =>
@adapter(key).read obj, key.path
publish: (value) =>
if @target?
@adapter(@key).publish @target, @key.path, value
value: =>
@read @key, @target if @target?
......