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 * Backend
*/ */
async function main() { (async () => {
window.yomichanBackend = new Backend(); window.yomichanBackend = new Backend();
await window.yomichanBackend.prepare(); await window.yomichanBackend.prepare();
} })();
main();

View File

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

View File

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

View File

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

View File

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

View File

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