Promise
Syntax
return new Dexie.Promise(function (resolve, reject) {
// Do something and call resolve / reject when done.
}).then(function (result) {
// This code is called if resolve() was called in the Promise constructor
}).catch(function (error) {
// This code is called if reject() was called in the Promise constructor, or
// if an exception was thrown in either constructor or previous then() call.
}).finally(function () {
// This code will be called no matter if an error occurred or not.
});