simplify onInstalled

This commit is contained in:
tophf 2018-08-06 18:20:57 +03:00
parent 91fb0579f1
commit be94303bad

View File

@ -119,22 +119,15 @@ prefs.subscribe(['iconset'], () =>
})); }));
// ************************************************************************* // *************************************************************************
{ chrome.runtime.onInstalled.addListener(({reason}) => {
const onInstall = ({reason}) => { if (reason !== 'update') return;
chrome.runtime.onInstalled.removeListener(onInstall); // translations may change
if (reason === 'update') { localStorage.L10N = JSON.stringify({
// translations may change browserUIlanguage: chrome.i18n.getUILanguage(),
localStorage.L10N = JSON.stringify({ });
browserUIlanguage: chrome.i18n.getUILanguage(), // themes may change
}); delete localStorage.codeMirrorThemes;
// 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'});
}
// ************************************************************************* // *************************************************************************
// browser commands // browser commands