aboutsummaryrefslogtreecommitdiff
path: root/ext/js/display/popup-main.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2024-02-07 02:55:48 -0500
committerGitHub <noreply@github.com>2024-02-07 07:55:48 +0000
commitdc22c0260e55121b2930f8bf8761271ba977503f (patch)
tree1c5cf6d59fb600dfc03e46f11d3fba3dfb30c8f1 /ext/js/display/popup-main.js
parent376bac7195bf2114da8b234ffa64af9751b4466d (diff)
Update application init process (#634)
Diffstat (limited to 'ext/js/display/popup-main.js')
-rw-r--r--ext/js/display/popup-main.js51
1 files changed, 19 insertions, 32 deletions
diff --git a/ext/js/display/popup-main.js b/ext/js/display/popup-main.js
index 2ca2fcd3..a244c2e0 100644
--- a/ext/js/display/popup-main.js
+++ b/ext/js/display/popup-main.js
@@ -17,7 +17,6 @@
*/
import {Application} from '../application.js';
-import {log} from '../core/logger.js';
import {DocumentFocusController} from '../dom/document-focus-controller.js';
import {HotkeyHandler} from '../input/hotkey-handler.js';
import {DisplayAnki} from './display-anki.js';
@@ -26,43 +25,31 @@ import {DisplayProfileSelection} from './display-profile-selection.js';
import {DisplayResizer} from './display-resizer.js';
import {Display} from './display.js';
-/** Entry point. */
-async function main() {
- try {
- const documentFocusController = new DocumentFocusController();
- documentFocusController.prepare();
+await Application.main(async (application) => {
+ const documentFocusController = new DocumentFocusController();
+ documentFocusController.prepare();
- const application = new Application();
- await application.prepare();
+ const {tabId, frameId} = await application.api.frameInformationGet();
- const {tabId, frameId} = await application.api.frameInformationGet();
+ const hotkeyHandler = new HotkeyHandler();
+ hotkeyHandler.prepare(application.crossFrame);
- const hotkeyHandler = new HotkeyHandler();
- hotkeyHandler.prepare(application.crossFrame);
+ const display = new Display(application, tabId, frameId, 'popup', documentFocusController, hotkeyHandler);
+ await display.prepare();
- const display = new Display(application, tabId, frameId, 'popup', documentFocusController, hotkeyHandler);
- await display.prepare();
+ const displayAudio = new DisplayAudio(display);
+ displayAudio.prepare();
- const displayAudio = new DisplayAudio(display);
- displayAudio.prepare();
+ const displayAnki = new DisplayAnki(display, displayAudio);
+ displayAnki.prepare();
- const displayAnki = new DisplayAnki(display, displayAudio);
- displayAnki.prepare();
+ const displayProfileSelection = new DisplayProfileSelection(display);
+ displayProfileSelection.prepare();
- const displayProfileSelection = new DisplayProfileSelection(display);
- displayProfileSelection.prepare();
+ const displayResizer = new DisplayResizer(display);
+ displayResizer.prepare();
- const displayResizer = new DisplayResizer(display);
- displayResizer.prepare();
+ display.initializeState();
- display.initializeState();
-
- document.documentElement.dataset.loaded = 'true';
-
- application.ready();
- } catch (e) {
- log.error(e);
- }
-}
-
-await main();
+ document.documentElement.dataset.loaded = 'true';
+});