将Chrome扩展程序移植到Firefox:等效于chrome.storage [英] Porting Chrome extension to Firefox : equivalent to chrome.storage
本文介绍了将Chrome扩展程序移植到Firefox:等效于chrome.storage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将Chrome扩展程序移植到Firefox,我想知道什么与 chrome.storage.local.set
和 chrome.storage.local.get 等效.在Firefox中添加代码>在SDK上.我认为这是
简单存储
.
I'm trying to port Chrome extension to Firefox and I would like to know what's the equivalent to chrome.storage.local.set
and chrome.storage.local.get
in Firefox add on sdk. I think, it's simple-storage
.
这是我的代码:
chrome.storage.local.set({'tokenFU': token});
[...]
chrome.storage.local.get('tokenFU',function(result){
token=result.tokenFU;
if(token && token != 'undefined'){
hideLog();
}
else
showLog();
});
提前谢谢!
推荐答案
Yes exactly, it is simple-storage. You can use it like this :
const storage = require("sdk/simple-storage").storage;
storage.tokenFu = token;
这篇关于将Chrome扩展程序移植到Firefox:等效于chrome.storage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文