Moving utils

This commit is contained in:
Official Noob
2019-12-31 19:01:17 +00:00
committed by GitHub
parent 84e4adbc12
commit 3fbb689e0a

View File

@@ -1,37 +1,3 @@
SB = {};
function configProxy() {
chrome.storage.onChanged.addListener((changes, namespace) => {
for (key in changes) {
localconfig[key] = changes[key].newValue;
}
});
var handler = {
set: function(obj, prop, value) {
chrome.storage.sync.set({
[prop]: value
})
},
get: function(obj, prop) {
return localconfig[prop]
}
};
return new Proxy({}, handler);
}
fetchConfig = _ => new Promise(function(resolve, reject) {
chrome.storage.sync.get(null, function(items) {
localconfig = items; // Data is ready
resolve();
});
});
async function config() {
localconfig = {};
await fetchConfig();
SB.config = configProxy();
}
//make this a function to allow this to run on the content page
async function runThePopup() {
localizeHtmlPage();