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/comm/frame-ancestry-handler.js | |
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/comm/frame-ancestry-handler.js')
-rw-r--r-- | ext/js/comm/frame-ancestry-handler.js | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/ext/js/comm/frame-ancestry-handler.js b/ext/js/comm/frame-ancestry-handler.js index b1ed7114..d53334e1 100644 --- a/ext/js/comm/frame-ancestry-handler.js +++ b/ext/js/comm/frame-ancestry-handler.js @@ -15,10 +15,6 @@ * along with this program. If not, see <https://www.gnu.org/licenses/>. */ -/* global - * api - */ - /** * This class is used to return the ancestor frame IDs for the current frame. * This is a workaround to using the `webNavigation.getAllFrames` API, which @@ -118,7 +114,7 @@ class FrameAncestryHandler { clearTimeout(timer); timer = null; } - api.crossFrame.unregisterHandler(responseMessageId); + yomichan.crossFrame.unregisterHandler(responseMessageId); }; const onMessage = (params) => { if (params.nonce !== nonce) { return null; } @@ -148,7 +144,7 @@ class FrameAncestryHandler { }; // Start - api.crossFrame.registerHandlers([[responseMessageId, {async: false, handler: onMessage}]]); + yomichan.crossFrame.registerHandlers([[responseMessageId, {async: false, handler: onMessage}]]); resetTimeout(); const frameId = this._frameId; this._requestFrameInfo(targetWindow, frameId, frameId, uniqueId, nonce); @@ -187,7 +183,7 @@ class FrameAncestryHandler { const responseMessageId = `${this._responseMessageIdBase}${uniqueId}`; try { - const response = await api.crossFrame.invoke(originFrameId, responseMessageId, responseParams); + const response = await yomichan.crossFrame.invoke(originFrameId, responseMessageId, responseParams); if (response === null) { return; } nonce = response.nonce; } catch (e) { |