mirror of
https://github.com/zhigang1992/reactfire.git
synced 2026-04-23 04:00:23 +08:00
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
This commit is contained in:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user