firebase promis

14 views
Skip to first unread message

Ashish Kumar

unread,
Apr 21, 2018, 5:28:39 PM4/21/18
to Firebase Google Group
i want to use then() function with on().

my syntax is
firebase.database().ref().on('child_added',function(data){

}).then(function(){

});
can i use it in this way.

Michael Bleigh

unread,
Apr 21, 2018, 6:00:22 PM4/21/18
to fireba...@googlegroups.com
No. You can only use 'then' with 'once' listeners -- promises must only be resolved once and child_added is explicitly intended to trigger an indefinite number of times.

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/9fae922c-39fb-4689-9623-e111a1ae68a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages