Porting Chrome extension to Firefox : equivalent to chrome.storage

被刻印的时光 ゝ 提交于 2021-02-19 01:25:47

问题


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.

Here is my code :

chrome.storage.local.set({'tokenFU': token});

[...]

chrome.storage.local.get('tokenFU',function(result){
                    token=result.tokenFU;
                    if(token && token != 'undefined'){
                        hideLog();
                    }
                    else 
                    showLog();
});

Thanks in advance !


回答1:


Yes exactly, it is simple-storage. You can use it like this :

const storage = require("sdk/simple-storage").storage;

storage.tokenFu = token;


来源:https://stackoverflow.com/questions/17142991/porting-chrome-extension-to-firefox-equivalent-to-chrome-storage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!