Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
rivets
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
27bc80be
authored
2013-12-03 22:36:43 -0800
by
Michael Richards
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Add a way to publish a change to a keypath (only goes through when resolvable).
1 parent
94ecb4ea
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletions
src/bindings.coffee
src/keypath_observer.coffee
src/bindings.coffee
View file @
27bc80b
...
...
@@ -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
...
...
src/keypath_observer.coffee
View file @
27bc80b
...
...
@@ -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
?
...
...
Please
register
or
sign in
to post a comment