Open devgeeks opened 7 years ago
Something asynchronous must be happening here somewhere...
Same behavior in node as in browser?
so this is synch, in the test.js
:
var echidna = new EchidnaDB(options);
Yeah, the function returns synchronously, but strangely the DB isn't actually ready immediately after it returns. :/
Wrapping the calls in an echidna.pouch.info()
does keep it from being called too early, but not sure if that is much more than just a fancy setTimeout()
.
This feels basically the same as the setTimeout
above, but yeah...
echidna.pouch.info().then(info => {
echidna.pouch.allDocs()
.then(docs => {
// do something with docs
})
.catch(error => {
// do something with the caught error
});
});
Throws an error:
Doesn't throw an error