-
Notifications
You must be signed in to change notification settings - Fork 12
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
Simplify PouchDB ctor definitions #23
Comments
Update from IRC chat with daleharvey: TL;DR: pouchdb officially does not support the ctor returning a promise, so we should remove it. Updating this issue accordingly (cc @fredgalvao).
|
Removed following feedback from daleharvey - pouchdb as a promise is only there to support legacy code.
Updated this issue, and the code (7ea6e81) following feedback from daleharvey. Comments from anyone? (cc @fredgalvao). |
That's awesome news! I didn't like that Doesn't that imply that the callback parameter passed on to the constructor is also deprecated and should not be advised? (In the end it's just another way to deal with async behaviour on the db instance, so it should inherit the same reasoning...) |
Relates to #22
Consider:
thenable.PouchDB
is a bad name (a realthenable
does not have acatch
anyway)thenable.PouchDB
is just there to be the return type for the promise-based constructors (i.e. to preventthen
showing up on your pouchdbdb
variable)promise.PouchDB
is exactly anapi.db.Promisable
pouchdb.promise.PouchDB
is there because, ideally, you would be able to dovar db : pouchdb.PouchDB
. However we are splitting callable and promise interfaces to help end-users, sovar db : pouchdb.promise.PouchDB
is seemed marginally more explanatory (and has one less level of nesting) thanvar db : pouchdb.api.db.Promisable
@fredgalvao commented, rightly, that this structure is confusing. So ... how can we improve it?
Suggestions:
module promise
tomodule promisable
in keeping with RenamePromise
interfaces #22.module thenable
tomodule promisable
and removemodule promise
.module db
and use those instead ofmodule callback
andmodule promise
I personally don't like this (which would be a vote against option 2):
compared to
Purely because
dbp
is aPouchDB
, not aPromisable
Option 3 might be the best option.
module db
is a little superfluous - I only put it there to be clear where the main db interfaces were defined, but then ended up needing thecallback
andpromise
modules which are only there to improve the external naming.The text was updated successfully, but these errors were encountered: