Remove event dependency from Rivets.Binding::publish.
Showing
1 changed file
with
4 additions
and
5 deletions
... | @@ -65,6 +65,10 @@ class Rivets.Binding | ... | @@ -65,6 +65,10 @@ class Rivets.Binding |
65 | else | 65 | else |
66 | Rivets.config.adapter.read @model, @keypath | 66 | Rivets.config.adapter.read @model, @keypath |
67 | 67 | ||
68 | # Publishes the value currently set on the input element back to the model. | ||
69 | publish: => | ||
70 | Rivets.config.adapter.publish @model, @keypath, getInputValue @el | ||
71 | |||
68 | # Subscribes to the model for changes at the specified keypath. Bi-directional | 72 | # Subscribes to the model for changes at the specified keypath. Bi-directional |
69 | # routines will also listen for changes on the element to propagate them back | 73 | # routines will also listen for changes on the element to propagate them back |
70 | # to the model. | 74 | # to the model. |
... | @@ -82,11 +86,6 @@ class Rivets.Binding | ... | @@ -82,11 +86,6 @@ class Rivets.Binding |
82 | if @isBidirectional() | 86 | if @isBidirectional() |
83 | bindEvent @el, 'change', @publish | 87 | bindEvent @el, 'change', @publish |
84 | 88 | ||
85 | # Publishes the value currently set on the input element back to the model. | ||
86 | publish: (e) => | ||
87 | el = e.target or e.srcElement | ||
88 | Rivets.config.adapter.publish @model, @keypath, getInputValue el | ||
89 | |||
90 | # Unsubscribes from the model and the element. | 89 | # Unsubscribes from the model and the element. |
91 | unbind: => | 90 | unbind: => |
92 | unless @options.bypass | 91 | unless @options.bypass | ... | ... |
-
Please register or sign in to post a comment