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

92
Views
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
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!