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

247
Visualizações
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 Respostas
Responde à pergunta

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 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