synchronize
synchronize copied to clipboard
using simple await defer with Firebase callback throws error
I'm trying to wrap and sync Firebase query methods as follows
sync.fiber(function() {
var ref = sync.await(spotsRef.once('value', sync.defer()));
console.log("ref", ref);
return ref;
});
And I get this error:
/home/my-app/node_modules/synchronize/sync.js:111
fiber.throwInto(err)
^
[object Object]
API for Firebase .once method
.once method like this? https://github.com/firebase/firebase-util/blob/d3a5b7d95/test/e2e/NormalizedCollection.e2e.js#L89
if that, i think you should change to this :)
sync.fiber(function() {
var defer = sync.defer();
spotsRef.once('value',
function(s) { defer(null, s); }, // success callback
defer); // failure callback
var ref = sync.await();
console.log('ref', ref);
return ref;
});
Thanks @d3m3vilurr! that worked.
Close this?
@bradvogel Yea, this issue is not a bug. :) But only can close @alexeypetrushin or @eladkarakuli