only-cliches/snap-db

Can we do `ready()` implicitly?

Closed this issue · 3 comments

huan commented

I understand that we need some initialization tasks before the db will be ready to use, so the code in the ready() is necessary.

However, the current design will force the user to call ready() before using the SnapDb, which I believe can be done inside the library itself.

I will get wrong with the following code:

const db = new SnapDb()
// await db.ready()
await db.put('a','b')

I would love to get it to work without the ready() call.

This feature will be live in version 1.1.2

huan commented

Thank you very much for your improvement!

It will help me to solve my problems inside my library, cheers!

1.1.2 is now live on NPM, this issue has been resolved. Feel free to comment if you find anything further!