Porting the Chrome extension to Firefox: equivalent to chrome.storage

I am trying to connect the Chrome extension to Firefox, and I would like to know what the equivalent of chrome.storage.local.set and chrome.storage.local.get in Firefox add to sdk. I think this is 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!

+6
source share
1 answer

Yes, it is this simple-storage . You can use it as follows:

 const storage = require("sdk/simple-storage").storage; storage.tokenFu = token; 
+4
source

Source: https://habr.com/ru/post/947435/


All Articles