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

SQLite: review constructor #592

Closed
mlynch opened this issue Sep 26, 2016 · 3 comments
Closed

SQLite: review constructor #592

mlynch opened this issue Sep 26, 2016 · 3 comments

Comments

@mlynch
Copy link
Collaborator

mlynch commented Sep 26, 2016

Right now the SQLite plugin requires you to call new on it before you use it. I don't think this should be required: https://github.com/litehelpers/Cordova-sqlite-storage

@mlynch mlynch added this to the 2.1.0 milestone Sep 26, 2016
@ihadeed
Copy link
Collaborator

ihadeed commented Sep 26, 2016

Yeah you're right...

openDatabase should be a static function that creates a new SQLite object and sets it's _objectInstance value. It will resolve an instance of SQLite on success, or reject with the error if failed.

SQLite.openDatabse('path/to/db').then((db: SQLite) => {

  db.transaction(...);

}).catch(e => console.log(e));

@mlynch
Copy link
Collaborator Author

mlynch commented Sep 26, 2016

Why does it need to be instance based?

@ihadeed
Copy link
Collaborator

ihadeed commented Sep 26, 2016

@mlynch to eliminate the need to use callbacks. Some methods have callbacks in them and if we don't make it instance based we wouldn't be able to replace those callbacks with promises.

@ihadeed ihadeed modified the milestones: 2.1.0, v2.3.0 Oct 11, 2016
@ihadeed ihadeed modified the milestone: v2.3.0 Jan 23, 2017
@ihadeed ihadeed closed this as completed Mar 24, 2017
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

2 participants