diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-05-24 13:30:40 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-24 13:30:40 -0400 |
commit | c61a87b152b91bdebe01eefdbc3fa00670a3071d (patch) | |
tree | 63a94eacdc437da1e166a72a9b4d4794df294f22 /ext/fg/js/content-script-main.js | |
parent | 83a577fa569e5a6d468e3b304313106bba3e1e49 (diff) |
API refactor (#532)
* Convert api.js into a class instance
* Use new api.* functions
* Fix missing binds
* Group functions with progress callbacks together
* Change style
* Fix API override not working
Diffstat (limited to 'ext/fg/js/content-script-main.js')
-rw-r--r-- | ext/fg/js/content-script-main.js | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/ext/fg/js/content-script-main.js b/ext/fg/js/content-script-main.js index 57386b85..b057ae3d 100644 --- a/ext/fg/js/content-script-main.js +++ b/ext/fg/js/content-script-main.js @@ -21,10 +21,7 @@ * Frontend * PopupFactory * PopupProxy - * apiBroadcastTab - * apiForwardLogsToBackend - * apiFrameInformationGet - * apiOptionsGet + * api */ async function createIframePopupProxy(frameOffsetForwarder, setDisabled) { @@ -36,7 +33,7 @@ async function createIframePopupProxy(frameOffsetForwarder, setDisabled) { } } ); - apiBroadcastTab('rootPopupRequestInformationBroadcast'); + api.broadcastTab('rootPopupRequestInformationBroadcast'); const {popupId, frameId: parentFrameId} = await rootPopupInformationPromise; const getFrameOffset = frameOffsetForwarder.getOffset.bind(frameOffsetForwarder); @@ -48,7 +45,7 @@ async function createIframePopupProxy(frameOffsetForwarder, setDisabled) { } async function getOrCreatePopup(depth) { - const {frameId} = await apiFrameInformationGet(); + const {frameId} = await api.frameInformationGet(); if (typeof frameId !== 'number') { const error = new Error('Failed to get frameId'); yomichan.logError(error); @@ -71,7 +68,7 @@ async function createPopupProxy(depth, id, parentFrameId) { } (async () => { - apiForwardLogsToBackend(); + api.forwardLogsToBackend(); await yomichan.prepare(); const data = window.frontendInitializationData || {}; @@ -112,7 +109,7 @@ async function createPopupProxy(depth, id, parentFrameId) { depth: isSearchPage ? 0 : depth, url: proxy ? await getPopupProxyUrl() : window.location.href }; - const options = await apiOptionsGet(optionsContext); + const options = await api.optionsGet(optionsContext); if (!proxy && frameOffsetForwarder === null) { frameOffsetForwarder = new FrameOffsetForwarder(); |