Revert "Remove the unbind function from Rivets.Binding until there's a fix for unsubscribing."
This reverts commit 87f558a9.
Showing
2 changed files
with
17 additions
and
0 deletions
... | @@ -20,6 +20,8 @@ | ... | @@ -20,6 +20,8 @@ |
20 | this.model = model; | 20 | this.model = model; |
21 | this.keypath = keypath; | 21 | this.keypath = keypath; |
22 | this.formatters = formatters != null ? formatters : []; | 22 | this.formatters = formatters != null ? formatters : []; |
23 | this.unbind = __bind(this.unbind, this); | ||
24 | |||
23 | this.publish = __bind(this.publish, this); | 25 | this.publish = __bind(this.publish, this); |
24 | 26 | ||
25 | this.bind = __bind(this.bind, this); | 27 | this.bind = __bind(this.bind, this); |
... | @@ -64,6 +66,14 @@ | ... | @@ -64,6 +66,14 @@ |
64 | return Rivets.config.adapter.publish(this.model, this.keypath, getInputValue(el)); | 66 | return Rivets.config.adapter.publish(this.model, this.keypath, getInputValue(el)); |
65 | }; | 67 | }; |
66 | 68 | ||
69 | Binding.prototype.unbind = function() { | ||
70 | var _ref; | ||
71 | Rivets.config.adapter.unsubscribe(this.model, this.keypath, this.set); | ||
72 | if (_ref = this.type, __indexOf.call(bidirectionals, _ref) >= 0) { | ||
73 | return this.el.removeEventListener('change', this.publish); | ||
74 | } | ||
75 | }; | ||
76 | |||
67 | return Binding; | 77 | return Binding; |
68 | 78 | ||
69 | })(); | 79 | })(); | ... | ... |
... | @@ -49,6 +49,13 @@ class Rivets.Binding | ... | @@ -49,6 +49,13 @@ class Rivets.Binding |
49 | el = e.target or e.srcElement | 49 | el = e.target or e.srcElement |
50 | Rivets.config.adapter.publish @model, @keypath, getInputValue el | 50 | Rivets.config.adapter.publish @model, @keypath, getInputValue el |
51 | 51 | ||
52 | # Unsubscribes from the model and the element | ||
53 | unbind: => | ||
54 | Rivets.config.adapter.unsubscribe @model, @keypath, @set | ||
55 | |||
56 | if @type in bidirectionals | ||
57 | @el.removeEventListener 'change', @publish | ||
58 | |||
52 | # A collection of bindings for a parent element. | 59 | # A collection of bindings for a parent element. |
53 | class Rivets.View | 60 | class Rivets.View |
54 | # The parent DOM element and the model objects for binding are passed into the | 61 | # The parent DOM element and the model objects for binding are passed into the | ... | ... |
-
Please register or sign in to post a comment