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 ...@@ -70,7 +70,7 @@ class Rivets.Binding
70 if @view.formatters[id]?.publish 70 if @view.formatters[id]?.publish
71 value = @view.formatters[id].publish value, args... 71 value = @view.formatters[id].publish value, args...
72 72
73 @observer.setValue value 73 @observer.publish value
74 74
75 # Subscribes to the model for changes at the specified keypath. Bi-directional 75 # Subscribes to the model for changes at the specified keypath. Bi-directional
76 # routines will also listen for changes on the element to propagate them back 76 # routines will also listen for changes on the element to propagate them back
......
...@@ -49,6 +49,10 @@ class Rivets.Observer ...@@ -49,6 +49,10 @@ class Rivets.Observer
49 read: (key, obj) => 49 read: (key, obj) =>
50 @adapter(key).read obj, key.path 50 @adapter(key).read obj, key.path
51 51
52 publish: (value) =>
53 if @target?
54 @adapter(@key).publish @target, @key.path, value
55
52 value: => 56 value: =>
53 @read @key, @target if @target? 57 @read @key, @target if @target?
54 58
......