From 754a14876ab3296d4b6fc896167cdfebd5a390ca Mon Sep 17 00:00:00 2001 From: Michael Bleigh Date: Fri, 23 Jan 2015 14:04:21 -0800 Subject: [PATCH] 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." --- firebase-element.html | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/firebase-element.html b/firebase-element.html index 9964156..d9b7098 100644 --- a/firebase-element.html +++ b/firebase-element.html @@ -136,6 +136,13 @@

My Firebase Data

* * @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 @@ -320,6 +327,7 @@

My Firebase Data

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(); }