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

95
Vistas
How can I clear storage.sync for my chrome extension?

I have a small chrome extension I've built using chrome.storage.sync api to cache user-entered data. However, when the user runs a delete operation, the data persists in the storage area, even after I run sync.remove and sync.clear- is there something I'm missing?

                chrome.storage.sync.get('tasks', function(obj) {
                
                //assign tasks array to variable
                var tasks = obj.hasOwnProperty('tasks') ? obj.tasks : [];
                    chrome.storage.sync.remove('tasks': liValue);
                    chrome.storage.sync.clear();
                //find and remove deleted task from array, checking against cached li text value
                //liValue is cached textnode value prior to dom deletion
                for(var j = 0; j < tasks.length; j++) {
                    if(tasks[j] == liValue) {
                        tasks.splice(j, 1);
                        alert("splicing " + tasks[j] + "!!!");
                    }
                }
                //reset tasks in storage
                chrome.storage.sync.set({'tasks': tasks}, function() {
                    if (chrome.runtime.lastError)
                        console.log(chrome.runtime.lastError);
                    else
                        console.log("Tasks saved successfully");
                });

            });

I've looked thru the docs here and as best I can tell I'm using the method signatures correctly. Somebody described a similar issue in this SO post but applying the same code does not seem to be resolving my issue.

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