Skip to content

Commit c3b8881

Browse files
committed
Allow a callback to be passed for the cancelCallback argument to firebaseRef.on()
Not sure how to add a test to your suite for this, but have checked it at least works locally in react-hn against the Hacker News API, which errors when attempting to load delayed comments
1 parent c13e4aa commit c3b8881

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/reactfire.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ var ReactFireMixin = {
2222
/* BINDING */
2323
/*************/
2424
/* Creates a binding between Firebase and the inputted bind variable as an array */
25-
bindAsArray: function(firebaseRef, bindVar) {
26-
this._bind(firebaseRef, bindVar, true);
25+
bindAsArray: function(firebaseRef, bindVar, cancelCallback) {
26+
this._bind(firebaseRef, bindVar, cancelCallback, true);
2727
},
2828

2929
/* Creates a binding between Firebase and the inputted bind variable as an object */
30-
bindAsObject: function(firebaseRef, bindVar) {
31-
this._bind(firebaseRef, bindVar, false);
30+
bindAsObject: function(firebaseRef, bindVar, cancelCallback) {
31+
this._bind(firebaseRef, bindVar, cancelCallback, false);
3232
},
3333

3434
/* Creates a binding between Firebase and the inputted bind variable as either an array or object */
35-
_bind: function(firebaseRef, bindVar, bindAsArray) {
35+
_bind: function(firebaseRef, bindVar, cancelCallback, bindAsArray) {
3636
this._validateBindVar(bindVar);
3737

3838
var errorMessage, errorCode;
@@ -61,7 +61,7 @@ var ReactFireMixin = {
6161
newState[bindVar] = dataSnapshot.val();
6262
}
6363
this.setState(newState);
64-
}.bind(this));
64+
}.bind(this), cancelCallback);
6565
},
6666

6767
/* Removes the binding between Firebase and the inputted bind variable */

0 commit comments

Comments
 (0)