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
f068c59b
authored
2012-07-07 16:46:03 -0700
by
Michael Richards
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge pull request #15 from wrapp/feature/unsubsribing
Enable a way of unbinding listeners
2 parents
472cd08f
5b536cc6
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
src/rivets.coffee
src/rivets.coffee
View file @
f068c59
...
...
@@ -26,16 +26,25 @@ class Rivets.Binding
# routines will also listen for changes on the element to propagate them back
# to the model.
bind
:
=>
Rivets
.
config
.
adapter
.
subscribe
@
model
,
@
keypath
,
(
value
)
=>
@
set
value
Rivets
.
config
.
adapter
.
subscribe
@
model
,
@
keypath
,
@
set
if
Rivets
.
config
.
preloadData
@
set
Rivets
.
config
.
adapter
.
read
@
model
,
@
keypath
if
@
type
in
bidirectionals
@
el
.
addEventListener
'change'
,
(
e
)
=>
@
el
.
addEventListener
'change'
,
@
publish
publish
:
(
e
)
=>
el
=
e
.
target
or
e
.
srcElement
Rivets
.
config
.
adapter
.
publish
@
model
,
@
keypath
,
getInputValue
el
# Unsubscribes from the model and the element
unbind
:
=>
Rivets
.
config
.
adapter
.
unsubscribe
@
model
,
@
keypath
,
@
set
if
@
type
in
bidirectionals
@
el
.
removeEventListener
'change'
,
@
publish
# A collection of bindings for a parent element.
class
Rivets
.
View
# The parent DOM element and the model objects for binding are passed into the
...
...
Please
register
or
sign in
to post a comment