27 lines
512 B
JavaScript
27 lines
512 B
JavaScript
|
/*
|
||
|
Default settings. Initialize storage to these values.
|
||
|
*/
|
||
|
var storage = {
|
||
|
url: '',
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
Generic error logger.
|
||
|
*/
|
||
|
function onError(e) {
|
||
|
console.error(e);
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
On startup, check whether we have stored settings.
|
||
|
If we don't, then store the default settings.
|
||
|
*/
|
||
|
function checkStoredSettings(storedSettings) {
|
||
|
if (!storedSettings.storage) {
|
||
|
browser.storage.local.set({storage});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
const gettingStoredSettings = browser.storage.local.get();
|
||
|
gettingStoredSettings.then(checkStoredSettings, onError);
|