websql-promisified
Use Web SQL and Cordova SQLite with ES6 promises. This is a very slim wrapper, minified size is only 1kb.
Installation
npm install --save websql-promisified
Usage
With then/catch
; const db = ;const websqlPromise = ; websqlPromise
With async/await
; const db = ;const websqlPromise = ; try const results = await websqlPromise // Do something with results array catch error // Something went wrong, see error.message
Query chaining
You can also chain your queries as you would normally do in Web SQL. Pass a
function as the third argument into your executeSql()
call. It should accept a
transaction object as the first argument and the result as the second. In the
callback you can execute new queries that depend on the result from previous
query.
The results array returned from transaction()
is filled in the same order
your queries execute.
; const db = ;const websqlPromise = ; try const results = await websqlPromise console // a console // aa catch error // Something went wrong, see error.message
Found a bug?
Open an issue with a detailed description. Pull requests are most welcome!