从chrome.storage.local切换到chrome.storage.sync

时间:2016-06-16 09:26:03

标签: javascript google-chrome google-chrome-extension chrome-sync

我是使用Chrome扩展程序的新手,并且遇到了一个非常容易的主要绊脚石。我有一个使用本地存储的扩展程序,我希望修改扩展名以支持chrome.storage.sync。

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_);
}

我相信如果进行了任何更改,我可以修改侦听器以存储到chrome.storage.sync。寻找一些建议。非常感谢任何看到这一点的人。

0 个答案:

没有答案
相关问题