Set up dependency observers in Rivets.Binding::bind() that recompute the value a…
…t the original keypath.
Showing
1 changed file
with
8 additions
and
0 deletions
... | @@ -63,6 +63,14 @@ class Rivets.Binding | ... | @@ -63,6 +63,14 @@ class Rivets.Binding |
63 | if Rivets.config.preloadData | 63 | if Rivets.config.preloadData |
64 | @set Rivets.config.adapter.read @model, @keypath | 64 | @set Rivets.config.adapter.read @model, @keypath |
65 | 65 | ||
66 | if @options.dependencies?.length | ||
67 | for keypath in @options.dependencies | ||
68 | Rivets.config.adapter.subscribe @model, keypath, (stub) => | ||
69 | @set if @options.bypass | ||
70 | @model[@keypath] | ||
71 | else | ||
72 | Rivets.config.adapter.read @model, @keypath | ||
73 | |||
66 | if @type in @bidirectionals | 74 | if @type in @bidirectionals |
67 | bindEvent @el, 'change', @publish | 75 | bindEvent @el, 'change', @publish |
68 | 76 | ... | ... |
-
Please register or sign in to post a comment