· 9 years ago · Nov 02, 2016, 05:28 PM
1window.sqlitePlugin.openDatabase({name: 'my.db', location: 'default'}, function(db) {
2 db.transaction(function(tx) {
3 tx.executeSql('CREATE TABLE IF NOT EXISTS CACHE_VALUES (key, value)');
4 console.log('Db Created/opened');
5 }, function(err) {
6 console.log('Open database ERROR: ' + JSON.stringify(err));
7 });
8 });
9
10function createOrOpenDB() {
11 // here the create DB plugin invokes.
12 return true;
13}
14
15var ret = createOrOpenDB(); //this should wait until the DB is created.