diff --git a/src/reactfire.js b/src/reactfire.js index 474878c4..9bb1b9c5 100644 --- a/src/reactfire.js +++ b/src/reactfire.js @@ -22,17 +22,17 @@ var ReactFireMixin = { /* BINDING */ /*************/ /* Creates a binding between Firebase and the inputted bind variable as an array */ - bindAsArray: function(firebaseRef, bindVar) { - this._bind(firebaseRef, bindVar, true); + bindAsArray: function(firebaseRef, bindVar, cancelCallback) { + this._bind(firebaseRef, bindVar, cancelCallback, true); }, /* Creates a binding between Firebase and the inputted bind variable as an object */ - bindAsObject: function(firebaseRef, bindVar) { - this._bind(firebaseRef, bindVar, false); + bindAsObject: function(firebaseRef, bindVar, cancelCallback) { + this._bind(firebaseRef, bindVar, cancelCallback, false); }, /* Creates a binding between Firebase and the inputted bind variable as either an array or object */ - _bind: function(firebaseRef, bindVar, bindAsArray) { + _bind: function(firebaseRef, bindVar, cancelCallback, bindAsArray) { this._validateBindVar(bindVar); var errorMessage, errorCode; @@ -61,7 +61,7 @@ var ReactFireMixin = { newState[bindVar] = dataSnapshot.val(); } this.setState(newState); - }.bind(this)); + }.bind(this), cancelCallback); }, /* Removes the binding between Firebase and the inputted bind variable */ diff --git a/tests/specs/reactfire.spec.js b/tests/specs/reactfire.spec.js index d769db58..a9d6ce2c 100644 --- a/tests/specs/reactfire.spec.js +++ b/tests/specs/reactfire.spec.js @@ -470,8 +470,8 @@ describe("ReactFireMixin Tests:", function() { componentWillMount: function() { var _this = this; - expect(function() { _this._bind(firebaseRef, "items", true); }).not.toThrow(); - expect(function() { _this._bind(firebaseRef, "items", false); }).not.toThrow(); + expect(function() { _this._bind(firebaseRef, "items", function() {}, true); }).not.toThrow(); + expect(function() { _this._bind(firebaseRef, "items", function() {}, false); }).not.toThrow(); }, render: function() {