diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2024-02-01 10:00:59 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-01 15:00:59 +0000 |
commit | dfd42bad0b46845ad88d1fdc5fa82b4f03bab0f3 (patch) | |
tree | 04686b943b84b33b8927238be17e4bc0dda7eb62 /ext/js/display/search-main.js | |
parent | 2356223942a21d1683ac38eed8e7b9485f453d87 (diff) |
Application refactor (#591)
* Rename Yomitan class to Application, change initialization style
* Rename file
* Update init
* Update config
* Remove dead code
Diffstat (limited to 'ext/js/display/search-main.js')
-rw-r--r-- | ext/js/display/search-main.js | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/ext/js/display/search-main.js b/ext/js/display/search-main.js index dedad163..dc4f1b7e 100644 --- a/ext/js/display/search-main.js +++ b/ext/js/display/search-main.js @@ -16,10 +16,10 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ +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 {yomitan} from '../yomitan.js'; import {DisplayAnki} from './display-anki.js'; import {DisplayAudio} from './display-audio.js'; import {Display} from './display.js'; @@ -30,6 +30,8 @@ import {SearchPersistentStateController} from './search-persistent-state-control /** Entry point. */ async function main() { try { + const application = new Application(); + const documentFocusController = new DocumentFocusController('#search-textbox'); documentFocusController.prepare(); @@ -39,14 +41,14 @@ async function main() { const searchActionPopupController = new SearchActionPopupController(searchPersistentStateController); searchActionPopupController.prepare(); - await yomitan.prepare(); + await application.prepare(); - const {tabId, frameId} = await yomitan.api.frameInformationGet(); + const {tabId, frameId} = await application.api.frameInformationGet(); const hotkeyHandler = new HotkeyHandler(); - hotkeyHandler.prepare(); + hotkeyHandler.prepare(application.crossFrame); - const display = new Display(tabId, frameId, 'search', documentFocusController, hotkeyHandler); + const display = new Display(application, tabId, frameId, 'search', documentFocusController, hotkeyHandler); await display.prepare(); const displayAudio = new DisplayAudio(display); @@ -62,7 +64,7 @@ async function main() { document.documentElement.dataset.loaded = 'true'; - yomitan.ready(); + application.ready(); } catch (e) { log.error(e); } |