Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

164
Visualizações
Create multiple Schema in indexed DB

I am trying to create mutiple schema with indexed db , the scripts that implemented is

    const openDB = () => {
        var indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB || window.shimIndexedDB;

        // Create multiple schema
        // Create a dynamic Schema to append data
        var open = indexedDB.open("ExcelExtension", 1);
        open.onupgradeneeded = function () {
            var db = open.result;
            var store_sheet = db.createObjectStore("schema_1", { keyPath: "id" });
            var index = store_sheet.createIndex("NameIndex", ["name.last", "name.first"]);
        };

        open.onupgradeneeded = function () {
            var db2 = open.result;
            var store_sheet2 = db2.createObjectStore("schema_2", { keyPath: "id" });
            var index = store_sheet2.createIndex("NameIndex2", ["name.last", "name.first"]);
        };
    }

//html <button onlick="openDB()> Create DB

what did i do wrong ? there is no error in script but its only reflecting one schema in db

When i check on my database on browser, i can see only one schema was createdenter image description here

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Review how event listeners/handlers work in JavaScript. There are generally two ways to register an event handler:

// way 1
thing.onsomeevent = myEventHandler;
// way 2
thing.addEventListener('someevent', myEventHandler)

Most of the time it does not matter which syntax you use because most of the time you are only registering one event handler.

However, sometimes there is a big difference. The difference between the two methods is that when you have multiple event handlers, in the property assignment approach it overwrites all event handlers registered with one event handler. In the second way, it does not overwrite.

You can only register multiple event handlers using the add event listener syntax.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda