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
cd102889
authored
2013-10-31 17:16:17 -0700
by
Michael Richards
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Make sure that we unsubscribe the whole keypath observer when unbinding a binding for good. [#223]
1 parent
f35223d4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletions
src/bindings.coffee
src/keypath_observer.coffee
src/bindings.coffee
View file @
cd10288
...
...
@@ -107,7 +107,10 @@ class Rivets.Binding
# Unsubscribes from the model and the element.
unbind
:
(
silent
=
false
)
=>
@
binder
.
unbind
?
.
call
@
,
@
el
unless
silent
unless
silent
@
binder
.
unbind
?
.
call
@
,
@
el
@
observer
.
unobserve
()
@
view
.
adapters
[
@
key
.
interface
].
unsubscribe
(
@
model
,
@
key
.
path
,
@
sync
)
if
@
key
if
@
dependencies
.
length
...
...
src/keypath_observer.coffee
View file @
cd10288
...
...
@@ -39,3 +39,8 @@ class KeypathObserver
current
=
@
view
.
adapters
[
token
.
interface
].
read
current
,
token
.
path
current
unobserve
:
=>
for
token
,
index
in
@
tokens
if
obj
=
@
objectPath
[
index
]
@
view
.
adapters
[
token
.
interface
].
unsubscribe
obj
,
token
.
path
,
@
update
...
...
Please
register
or
sign in
to post a comment