Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/reactfire.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
Expand Down
4 changes: 2 additions & 2 deletions tests/specs/reactfire.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down