-
-
Notifications
You must be signed in to change notification settings - Fork 668
Dexie.async()
David Fahlander edited this page Mar 15, 2016
·
15 revisions
var myAsyncFunction = Dexie.async(function* () {
// Function body goes here.
// To await, use the yield keyword.
});
Makes it possible to use async functions with modern browsers (Chrome, Firefox, Opera and Edge) without the need of a transpiler.
+----------------------------------+--------------------------+
| ES6 syntax | ES7 equivalent syntax |
+----------------------------------+--------------------------+
| Dexie.async(function* () {}); | async function() {} |
+----------------------------------+--------------------------+
| Dexie.spawn(function* () {}); | (async function() {})() |
+----------------------------------+--------------------------+
| await p; | yield p; |
+-------------------------------------------------------------+
db.delete().then(function() {
console.log("Database successfully deleted");
}).catch(function (err) {
console.error("Could not delete database");
}).finally(function() {
// Do what should be done next...
});
Dexie.js - minimalistic and bullet proof indexedDB library