Switching from chrome.storage.local to chrome.storage.sync

116 Views Asked by At

I am new to playing around with Chrome Extensions and have come across a major stumbling point for something that should be quite easy. I have an extension using local storage and I'm looking to modify the extension to support chrome.storage.sync instead.

function LocalStateStore(on_change_callback, storage, storage_area) {

  this.storage_ = storage || chrome.storage;

  this.storage_area_ = storage_area || chrome.storage.sync;

  this.callback_ = on_change_callback;

  if (this.callback_)
     this.storage_.onChanged.addListener(this.callback_);
}

I believe I could modify the listener to also store to chrome.storage.sync if any changes were made. Looking for some advice. Many thanks to anyone who sees this.

0

There are 0 best solutions below