firebase-element
firebase-element copied to clipboard
Need an event to know when data has been fetched
It's really necessary to know when data has been retrieved.
At the moment the only solution is to attach an observer to the property that we binded to the data attribute and listen for changes. But this is troublesome since this property can change by other means then being retrieved from firebase.
Something like on-data-fetchedor similar, that gets called whenever new data is retrieved via a firebase-element (document or collection).
Please refer to firebase events documentation here, to learn about events provided by the Firebase core library, and once you have learned them, i can tell you that Polymer.FirebaseQueryBehavior fires the following events:
- firebase-child-added
- firebase-child-removed
- firebase-child-changed
- firebase-child-moved
which you can use them by doing something like that
var fbEl = document.querySelector('firebase-collection');
fbEl.addEventListener('firebase-child-added', function(event){
})
@ifaris7: In your list of events, you omitted firebase-value. But the problem is, all these events fire only after something "happens" to the firebase node or, in the case of firebase-value when a value is returned by the node query.
But we also need to know when the query returns null or undefined i.e., there is no firebase node at the end of the location property of the <firebase-collection> element.