-
-
Notifications
You must be signed in to change notification settings - Fork 647
Dexie.on.versionchange
David Fahlander edited this page Mar 27, 2014
·
12 revisions
db.on("versionchange", function (event) {});
The "versionchange" event occurs if another indexedDB database instance with a newer version of the database needs to upgrade the database. If you do not subscribe to this event, Dexie has a built-in default implementation that will close the database immediately and reload the current web page. This will resume the upgrading process of the other page and the current page will be refreshed to get the latest version.
To override the default behavior, your subscriber function must return false.
var db = new Dexie("MyDB");
db.on("versionchange", function(event) {
if (!confirm ("Another page tries to upgrade the database to version " + event.newVersion +
". Accept?")) {
return false;
}
};
Dexie.js - minimalistic and bullet proof indexedDB library