simplify onInstalled
This commit is contained in:
parent
91fb0579f1
commit
be94303bad
|
@ -119,22 +119,15 @@ prefs.subscribe(['iconset'], () =>
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// *************************************************************************
|
// *************************************************************************
|
||||||
{
|
chrome.runtime.onInstalled.addListener(({reason}) => {
|
||||||
const onInstall = ({reason}) => {
|
if (reason !== 'update') return;
|
||||||
chrome.runtime.onInstalled.removeListener(onInstall);
|
|
||||||
if (reason === 'update') {
|
|
||||||
// translations may change
|
// translations may change
|
||||||
localStorage.L10N = JSON.stringify({
|
localStorage.L10N = JSON.stringify({
|
||||||
browserUIlanguage: chrome.i18n.getUILanguage(),
|
browserUIlanguage: chrome.i18n.getUILanguage(),
|
||||||
});
|
});
|
||||||
// themes may change
|
// themes may change
|
||||||
delete localStorage.codeMirrorThemes;
|
delete localStorage.codeMirrorThemes;
|
||||||
}
|
});
|
||||||
};
|
|
||||||
// bind for 60 seconds max and auto-unbind if it's a normal run
|
|
||||||
chrome.runtime.onInstalled.addListener(onInstall);
|
|
||||||
setTimeout(onInstall, 60e3, {reason: 'unbindme'});
|
|
||||||
}
|
|
||||||
|
|
||||||
// *************************************************************************
|
// *************************************************************************
|
||||||
// browser commands
|
// browser commands
|
||||||
|
|
Loading…
Reference in New Issue
Block a user