82156981 by Michael Richards

Revert "Remove the unbind function from Rivets.Binding until there's a fix for unsubscribing."

This reverts commit 87f558a9.
1 parent 3709889f
......@@ -20,6 +20,8 @@
this.model = model;
this.keypath = keypath;
this.formatters = formatters != null ? formatters : [];
this.unbind = __bind(this.unbind, this);
this.publish = __bind(this.publish, this);
this.bind = __bind(this.bind, this);
......@@ -64,6 +66,14 @@
return Rivets.config.adapter.publish(this.model, this.keypath, getInputValue(el));
};
Binding.prototype.unbind = function() {
var _ref;
Rivets.config.adapter.unsubscribe(this.model, this.keypath, this.set);
if (_ref = this.type, __indexOf.call(bidirectionals, _ref) >= 0) {
return this.el.removeEventListener('change', this.publish);
}
};
return Binding;
})();
......
......@@ -49,6 +49,13 @@ class Rivets.Binding
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
......