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

using simple await defer with Firebase callback throws error #41

Open
eladkarakuli opened this issue Dec 14, 2015 · 4 comments
Open

using simple await defer with Firebase callback throws error #41

eladkarakuli opened this issue Dec 14, 2015 · 4 comments

Comments

@eladkarakuli
Copy link

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

@d3m3vilurr
Copy link
Collaborator

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

@eladkarakuli
Copy link
Author

Thanks @d3m3vilurr! that worked.

@bradvogel
Copy link
Collaborator

Close this?

@d3m3vilurr
Copy link
Collaborator

@bradvogel Yea, this issue is not a bug. :) But only can close @alexeyPetrushin or @eladkarakuli

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