simplify onInstalled
This commit is contained in:
parent
91fb0579f1
commit
be94303bad
|
@ -119,22 +119,15 @@ prefs.subscribe(['iconset'], () =>
|
|||
}));
|
||||
|
||||
// *************************************************************************
|
||||
{
|
||||
const onInstall = ({reason}) => {
|
||||
chrome.runtime.onInstalled.removeListener(onInstall);
|
||||
if (reason === 'update') {
|
||||
// translations may change
|
||||
localStorage.L10N = JSON.stringify({
|
||||
browserUIlanguage: chrome.i18n.getUILanguage(),
|
||||
});
|
||||
// themes may change
|
||||
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'});
|
||||
}
|
||||
chrome.runtime.onInstalled.addListener(({reason}) => {
|
||||
if (reason !== 'update') return;
|
||||
// translations may change
|
||||
localStorage.L10N = JSON.stringify({
|
||||
browserUIlanguage: chrome.i18n.getUILanguage(),
|
||||
});
|
||||
// themes may change
|
||||
delete localStorage.codeMirrorThemes;
|
||||
});
|
||||
|
||||
// *************************************************************************
|
||||
// browser commands
|
||||
|
|
Loading…
Reference in New Issue
Block a user