summaryrefslogtreecommitdiff
path: root/ext/js/pages/settings/popup-preview-frame-main.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/pages/settings/popup-preview-frame-main.js')
-rw-r--r--ext/js/pages/settings/popup-preview-frame-main.js43
1 files changed, 16 insertions, 27 deletions
diff --git a/ext/js/pages/settings/popup-preview-frame-main.js b/ext/js/pages/settings/popup-preview-frame-main.js
index fd08bf1d..cffbf01b 100644
--- a/ext/js/pages/settings/popup-preview-frame-main.js
+++ b/ext/js/pages/settings/popup-preview-frame-main.js
@@ -18,37 +18,26 @@
import {PopupFactory} from '../../app/popup-factory.js';
import {Application} from '../../application.js';
-import {log} from '../../core/logger.js';
import {HotkeyHandler} from '../../input/hotkey-handler.js';
import {PopupPreviewFrame} from './popup-preview-frame.js';
-/** Entry point. */
-async function main() {
- try {
- const application = new Application();
- await application.prepare();
-
- const {tabId, frameId} = await application.api.frameInformationGet();
- if (typeof tabId === 'undefined') {
- throw new Error('Failed to get tabId');
- }
- if (typeof frameId === 'undefined') {
- throw new Error('Failed to get frameId');
- }
-
- const hotkeyHandler = new HotkeyHandler();
- hotkeyHandler.prepare(application.crossFrame);
+await Application.main(async (application) => {
+ const {tabId, frameId} = await application.api.frameInformationGet();
+ if (typeof tabId === 'undefined') {
+ throw new Error('Failed to get tabId');
+ }
+ if (typeof frameId === 'undefined') {
+ throw new Error('Failed to get frameId');
+ }
- const popupFactory = new PopupFactory(application, frameId);
- popupFactory.prepare();
+ const hotkeyHandler = new HotkeyHandler();
+ hotkeyHandler.prepare(application.crossFrame);
- const preview = new PopupPreviewFrame(application, tabId, frameId, popupFactory, hotkeyHandler);
- await preview.prepare();
+ const popupFactory = new PopupFactory(application, frameId);
+ popupFactory.prepare();
- document.documentElement.dataset.loaded = 'true';
- } catch (e) {
- log.error(e);
- }
-}
+ const preview = new PopupPreviewFrame(application, tabId, frameId, popupFactory, hotkeyHandler);
+ await preview.prepare();
-await main();
+ document.documentElement.dataset.loaded = 'true';
+});