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
51018f8d
authored
2012-11-17 11:00:19 -0800
by
Michael Richards
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Clean up the reverse formatter loop in publish and remove the value condition at…
… the end. [Closes #97]
1 parent
babbf49a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
12 deletions
src/rivets.coffee
src/rivets.coffee
View file @
51018f8
...
...
@@ -70,18 +70,15 @@ class Rivets.Binding
# Publishes the value currently set on the input element back to the model.
publish
:
=>
value
=
getInputValue
@
el
if
@
formatters
i
=
@
formatters
.
length
-
1
while
(
i
>
-
1
)
formatter
=
@
formatters
[
i
]
args
=
formatter
.
split
/\s+/
id
=
args
.
shift
()
# only re-assign if there is a two-way formatter.
if
Rivets
.
formatters
[
id
]
and
Rivets
.
formatters
[
id
].
publish
value
=
Rivets
.
formatters
[
id
].
publish
value
,
args
...
i
--
if
(
value
)
Rivets
.
config
.
adapter
.
publish
@
model
,
@
keypath
,
value
for
formatter
in
@
formatters
.
slice
(
0
).
reverse
()
args
=
formatter
.
split
/\s+/
id
=
args
.
shift
()
if
Rivets
.
formatters
[
id
]
?
.
publish
value
=
Rivets
.
formatters
[
id
].
publish
value
,
args
...
Rivets
.
config
.
adapter
.
publish
@
model
,
@
keypath
,
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
...
...
Please
register
or
sign in
to post a comment