Minh Nguyen Minh Nguyen - 11 months ago 57
Javascript Question

Firebase "once" event does not return promise

In official document of firebase https://www.firebase.com/docs/web/api/query/once.html. It writed

Return Value

Returns a Promise that can optionally be used instead of the successCallback and failureCallback to handle success and failure.

But in my example code there are no promise return when call once function

fb.once('value', function(snapshoot){
var book = new Book(snap);
//following lines below cause error because of no promise returned.
console.log('promise called');

Please see full code at jsfiddle: http://jsfiddle.net/7e4j77q7/5/

What i'm doing wrong here? How can i let once function return promise?


It seems like you are using older version of firebase, the DOC you are referring has 2.4.2 version & you had older version 1.0.11