use local `this` variable instead of .bind

pull/1178/head
Rich Harris 7 years ago committed by GitHub
parent 389b5c9ff9
commit 957179fc7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -111,11 +111,14 @@ assign(Store.prototype, {
onchange: function(callback) { onchange: function(callback) {
this._changeHandlers.push(callback); this._changeHandlers.push(callback);
var store = this;
return { return {
cancel: function() { cancel: function() {
var index = this._changeHandlers.indexOf(callback); var index = store._changeHandlers.indexOf(callback);
if (~index) this._changeHandlers.splice(index, 1); if (~index) store._changeHandlers.splice(index, 1);
}.bind(this) }
}; };
}, },

Loading…
Cancel
Save