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

250
Views
how fire upgradeneeded event with out upgrade version of the indedexdb

i have a question about the event "upgradeneeded".

i need to check the data base every time the user reload the page, but how to fire it with out upgrade the version of the indexeddb, or it's the unique solution ?

request.addEventListener('upgradeneeded', event => {
var db = event.target.result;
var planningObjectStore = db.transaction("planningSave", "read").objectStore("planningSave");
});                 
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

"upgradeneeded" is only fired when you need to change the schema, which you signal by changing the version number. If you're not modifying the schema - e.g. you're just reading/writing to existing object stores - use the "success" event instead. Also, there's an implicit transaction within the "upgradeneeded" event, so no need to call transaction() there.

var request = indexedDB.open("mydb", 1); // version 1

// only fires for newly created databases, before "success"
request.addEventListener("upgradeneeded", event => {
  var db = event.target.result;
  var planningObjectStore = db.createObjectStore("planningSave");
  // write initial data into the store
});                

// fires after any successful open of the database
request.addEventListener("success", event => {
  var db = event.target.result;
  var tx = db.transaction("planningSave");
  var planningObjectStore = tx.objectStore("planningSave");
  // read data within the new transaction
});
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!