diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2021-02-14 15:53:35 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-14 15:53:35 -0500 |
commit | 286534e648af350d24fbf3c7892a7ec81aaeb4bd (patch) | |
tree | 89d88e961c5a0a6f508c66789e30b9ba4a968e73 /ext/js/input | |
parent | efe8140f103179f50b610f182148b9427af99010 (diff) |
Move api to yomichan object (#1392)
* Move cross frame API from API to Yomichan
* Add API instance to Yomichan
* Move api global to yomichan.api
* Pass yomichan to API
* Remove IIFE
Diffstat (limited to 'ext/js/input')
-rw-r--r-- | ext/js/input/hotkey-handler.js | 5 | ||||
-rw-r--r-- | ext/js/input/hotkey-help-controller.js | 3 |
2 files changed, 3 insertions, 5 deletions
diff --git a/ext/js/input/hotkey-handler.js b/ext/js/input/hotkey-handler.js index 423410b7..6db3e0f0 100644 --- a/ext/js/input/hotkey-handler.js +++ b/ext/js/input/hotkey-handler.js @@ -17,7 +17,6 @@ /* global * DocumentUtil - * api */ /** @@ -59,7 +58,7 @@ class HotkeyHandler extends EventDispatcher { prepare() { this._isPrepared = true; this._updateEventHandlers(); - api.crossFrame.registerHandlers([ + yomichan.crossFrame.registerHandlers([ ['hotkeyHandler.forwardHotkey', {async: false, handler: this._onMessageForwardHotkey.bind(this)}] ]); } @@ -259,7 +258,7 @@ class HotkeyHandler extends EventDispatcher { const frameId = this._forwardFrameId; if (frameId === null) { throw new Error('No forwarding target'); } try { - await api.crossFrame.invoke(frameId, 'hotkeyHandler.forwardHotkey', {key, modifiers}); + await yomichan.crossFrame.invoke(frameId, 'hotkeyHandler.forwardHotkey', {key, modifiers}); } catch (e) { // NOP } diff --git a/ext/js/input/hotkey-help-controller.js b/ext/js/input/hotkey-help-controller.js index 8137b50b..9bf95c77 100644 --- a/ext/js/input/hotkey-help-controller.js +++ b/ext/js/input/hotkey-help-controller.js @@ -17,7 +17,6 @@ /* global * HotkeyUtil - * api */ class HotkeyHelpController { @@ -29,7 +28,7 @@ class HotkeyHelpController { } async prepare() { - const {platform: {os}} = await api.getEnvironmentInfo(); + const {platform: {os}} = await yomichan.api.getEnvironmentInfo(); this._hotkeyUtil.os = os; await this._setupGlobalCommands(this._globalActionHotkeys); } |