Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

162
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!