Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Fire data-ready event on loaded data
Browse files Browse the repository at this point in the history
There's often a need to know when data has been read from the Firebase for the first time (e.g. to initialize an empty object), and while dataReady gives us this, there's presently no event fired to let us know "hey, we read the Firebase, nothing here."
  • Loading branch information
mbleigh committed Jan 23, 2015
1 parent 2e6f73e commit 754a148
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions firebase-element.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ <h3>My Firebase Data</h3>
*
* @event data-change
*/

/**
* Fired when the remote location has been read, whether or not data
* has been returned.
*
* @event data-ready
*/

/**
* Fired when an error occurs on an interaction with Firebase. The
Expand Down Expand Up @@ -320,6 +327,7 @@ <h3>My Firebase Data</h3>
this.log && console.log('acquired value ' + this.location);
this.dataReady = true;
this._setData(snapshot.val());
this.fire('data-ready', this.data);
if (this.data) {
this.dataChange();
}
Expand Down

0 comments on commit 754a148

Please sign in to comment.