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

Commit 754a148

Browse files
committed
Fire data-ready event on loaded data
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."
1 parent 2e6f73e commit 754a148

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

firebase-element.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,13 @@ <h3>My Firebase Data</h3>
136136
*
137137
* @event data-change
138138
*/
139+
140+
/**
141+
* Fired when the remote location has been read, whether or not data
142+
* has been returned.
143+
*
144+
* @event data-ready
145+
*/
139146

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

0 commit comments

Comments
 (0)