Giter VIP home page Giter VIP logo

Comments (3)

gilf avatar gilf commented on August 19, 2024

@GAlexMES,

You are trying to run two async operations in parallel and ending up with that error.
In order to correct your code you will have to run the second open in the then function of the first open call.

this.database.openDatabase(3, 
    (evt) => {
        console.log("version 3");
        this.database.openDatabase(2, ...)
    }(error) => {
      console.log(error);
    }
) 

from angular2-indexeddb.

GAlexMES avatar GAlexMES commented on August 19, 2024

@gilf

Okay, I tried it. It works, when I already have a version 3 database in my browser.
But when I have a version 0, 1 or 2 it failes, when I try to open it in an older version. So in your example "version 3" would be printed to the console and then I got an error.

Thanks for your help.

I resolved it with just opening it once with the current version and then doing a switch on the evt.oldVersion.

  this.database.openDatabase(3, (evt) => {
      switch (evt.oldVersion) {
        case 0: this.version0(evt);
        case 1: this.version1(evt);
        case 2: this.version2(evt);
        case 3: this.version3(evt);
      }

It is a bit dirty but It works for now.

from angular2-indexeddb.

gilf avatar gilf commented on August 19, 2024

@GAlexMES,

Thanks for letting me know.
I'm closing this issue and if I'll have any fix, I'll comment here.

from angular2-indexeddb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.