Promise.finally()
Syntax
promise.finally(function callback() {
// Do stuff when promise resolves or is rejected
})Return Value
Description
Sample
var db = new Dexie('db');
db.version(1).stores({friends: 'email,name'});
db.open();
// Un-remark following line to make it fail due to ConstraintError:
// db.friends.add({email: "[email protected]", name: "Oliver"});
db.friends.add({email: "[email protected]", name: "Gertrud"}).then(function() {
alert ("Successfully added friend into DB");
}).catch (function (e) {
alert ("Failed to add friend into DB: " + e);
}).finally (function() {
alert ("Finished!");
});