Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need an event to know when data has been fetched #86

Open
Whyser opened this issue Nov 7, 2015 · 2 comments
Open

Need an event to know when data has been fetched #86

Whyser opened this issue Nov 7, 2015 · 2 comments

Comments

@Whyser
Copy link

Whyser commented Nov 7, 2015

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).

@abusada
Copy link

abusada commented Nov 10, 2015

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){

})

@maria-le
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants