Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

114
Vistas
How do I add items instead of setting with the web extension storage api?

I am trying to make a recent system where, when you go to an id of an item it stores when u went to that id, something along the lines of this:

chrome.storage.local.set({
[variable of id]: {
 recentTime: new Date(),
 anotherVariable: "hello world"
}});

The problem is that i want to store 2 instances of history, so I want to add another one like this, this is where the problem appears, the previous keys are gone, since it's a set(), not an add()

chrome.storage.local.set({
[variable of id]: {
 recentTime2: new Date(),
 anotherVariable2: "hello world"
}});

however I can fix this by using chrome.storage.local.get() and doing Object.assign() with both variables when setting, this is a bit of a hassle and isn't very efficient but it's fine, I can deal with it.

but what if, I need to do in objects, something with a longer path like this:

chrome.storage.local.set({
something: {
 // there is a variable here in the storage
 something: {
  // there is a variable here in the storage again
  something: "a"
 }
}
});

And like this it becomes a big hassle, and becomes something hard to deal with. I could potentially do a function that can do this automatically but that is very hard for me.

Is there any other efficient way to do this?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda