Use IIFE for entry points

This commit is contained in:
toasted-nutbread 2020-04-22 21:42:20 -04:00
parent d106c638ed
commit d8276a9d5d
6 changed files with 12 additions and 24 deletions

View File

@ -19,9 +19,7 @@
* Backend
*/
async function main() {
(async () => {
window.yomichanBackend = new Backend();
await window.yomichanBackend.prepare();
}
main();
})();

View File

@ -88,8 +88,6 @@ async function mainInner() {
});
}
async function main() {
(async () => {
window.addEventListener('DOMContentLoaded', mainInner, false);
}
main();
})();

View File

@ -52,7 +52,7 @@ function injectSearchFrontend() {
}
}
async function main() {
(async () => {
await yomichan.prepare();
const displaySearch = new DisplaySearch();
@ -78,6 +78,4 @@ async function main() {
yomichan.on('optionsUpdated', applyOptions);
await applyOptions();
}
main();
})();

View File

@ -19,9 +19,7 @@
* SettingsPopupPreview
*/
async function main() {
(async () => {
const instance = new SettingsPopupPreview();
await instance.prepare();
}
main();
})();

View File

@ -61,7 +61,7 @@ async function createPopupProxy(depth, id, parentFrameId, url) {
return popup;
}
async function contentScriptMain() {
(async () => {
await yomichan.prepare();
const data = window.frontendInitializationData || {};
@ -128,6 +128,4 @@ async function contentScriptMain() {
window.addEventListener('fullscreenchange', applyOptions, false);
await applyOptions();
}
contentScriptMain();
})();

View File

@ -67,8 +67,6 @@ async function popupNestedInitialize(id, depth, parentFrameId, url) {
await applyOptions();
}
async function main() {
(async () => {
new DisplayFloat();
}
main();
})();