function init()

in public/dexie.js [1650:1690]


    function init() {
      // Default subscribers to "versionchange" and "blocked".
      // Can be overridden by custom handlers. If custom handlers return false, these default
      // behaviours will be prevented.
      db.on("versionchange", function (ev) {
        // Default behavior for versionchange event is to close database connection.
        // Caller can override this behavior by doing db.on("versionchange", function(){ return false; });
        // Let's not block the other window from making it's delete() or open() call.
        // NOTE! This event is never fired in IE,Edge or Safari.
        if (ev.newVersion > 0)
          console.warn(
            "Another connection wants to upgrade database '" +
              db.name +
              "'. Closing db now to resume the upgrade."
          );
        else
          console.warn(
            "Another connection wants to delete database '" +
              db.name +
              "'. Closing db now to resume the delete request."
          );
        db.close();
        // In many web applications, it would be recommended to force window.reload()
        // when this event occurs. To do that, subscribe to the versionchange event
        // and call window.location.reload(true) if ev.newVersion > 0 (not a deletion)
        // The reason for this is that your current web app obviously has old schema code that needs
        // to be updated. Another window got a newer version of the app and needs to upgrade DB but
        // your window is blocking it unless we close it here.
      });
      db.on("blocked", function (ev) {
        if (!ev.newVersion || ev.newVersion < ev.oldVersion)
          console.warn("Dexie.delete('" + db.name + "') was blocked");
        else
          console.warn(
            "Upgrade '" +
              db.name +
              "' blocked by other connection holding version " +
              ev.oldVersion / 10
          );
      });
    }