From bb8a521dff8ee314ab71bceb4bb2dcbe82b7a547 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 8 Feb 2021 17:53:02 -0500 Subject: [PATCH] Remove unused api functions (#1354) * Remove screenshotGet * Remove downloadDefinitionAudio * Remove clipboardGetImage --- ext/bg/js/backend.js | 29 ----------------------------- ext/mixed/js/api.js | 12 ------------ 2 files changed, 41 deletions(-) diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 4a3b7663..55905fab 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -100,8 +100,6 @@ class Backend { ['suspendAnkiCardsForNote', {async: true, contentScript: true, handler: this._onApiSuspendAnkiCardsForNote.bind(this)}], ['commandExec', {async: false, contentScript: true, handler: this._onApiCommandExec.bind(this)}], ['getExpressionAudioInfoList', {async: true, contentScript: true, handler: this._onApiGetExpressionAudioInfoList.bind(this)}], - ['downloadDefinitionAudio', {async: true, contentScript: true, handler: this._onApiDownloadDefinitionAudio.bind(this)}], - ['screenshotGet', {async: true, contentScript: true, handler: this._onApiScreenshotGet.bind(this)}], ['sendMessageToFrame', {async: false, contentScript: true, handler: this._onApiSendMessageToFrame.bind(this)}], ['broadcastTab', {async: false, contentScript: true, handler: this._onApiBroadcastTab.bind(this)}], ['frameInformationGet', {async: true, contentScript: true, handler: this._onApiFrameInformationGet.bind(this)}], @@ -109,7 +107,6 @@ class Backend { ['getStylesheetContent', {async: true, contentScript: true, handler: this._onApiGetStylesheetContent.bind(this)}], ['getEnvironmentInfo', {async: false, contentScript: true, handler: this._onApiGetEnvironmentInfo.bind(this)}], ['clipboardGet', {async: true, contentScript: true, handler: this._onApiClipboardGet.bind(this)}], - ['clipboardGetImage', {async: true, contentScript: true, handler: this._onApiClipboardImageGet.bind(this)}], ['getDisplayTemplatesHtml', {async: true, contentScript: true, handler: this._onApiGetDisplayTemplatesHtml.bind(this)}], ['getZoom', {async: true, contentScript: true, handler: this._onApiGetZoom.bind(this)}], ['getDefaultAnkiFieldTemplates', {async: false, contentScript: true, handler: this._onApiGetDefaultAnkiFieldTemplates.bind(this)}], @@ -504,28 +501,6 @@ class Backend { return await this._audioDownloader.getExpressionAudioInfoList(source, expression, reading, details); } - async _onApiDownloadDefinitionAudio({sources, expression, reading, details}) { - return await this._downloadDefinitionAudio(sources, expression, reading, details); - } - - _onApiScreenshotGet({options}, sender) { - if (!(sender && sender.tab)) { - return Promise.resolve(); - } - - const windowId = sender.tab.windowId; - return new Promise((resolve, reject) => { - chrome.tabs.captureVisibleTab(windowId, options, (dataUrl) => { - const e = chrome.runtime.lastError; - if (e) { - reject(new Error(e.message)); - } else { - resolve(dataUrl); - } - }); - }); - } - _onApiSendMessageToFrame({frameId: targetFrameId, action, params}, sender) { if (!(sender && sender.tab)) { return false; @@ -572,10 +547,6 @@ class Backend { return this._clipboardReader.getText(); } - async _onApiClipboardImageGet() { - return this._clipboardReader.getImage(); - } - async _onApiGetDisplayTemplatesHtml() { return await this._fetchAsset('/mixed/display-templates.html'); } diff --git a/ext/mixed/js/api.js b/ext/mixed/js/api.js index 03e58f5e..fc765063 100644 --- a/ext/mixed/js/api.js +++ b/ext/mixed/js/api.js @@ -101,18 +101,10 @@ const api = (() => { return this._invoke('getExpressionAudioInfoList', {source, expression, reading, details}); } - downloadDefinitionAudio(sources, expression, reading, details) { - return this._invoke('downloadDefinitionAudio', {sources, expression, reading, details}); - } - commandExec(command, params) { return this._invoke('commandExec', {command, params}); } - screenshotGet(options) { - return this._invoke('screenshotGet', {options}); - } - sendMessageToFrame(frameId, action, params) { return this._invoke('sendMessageToFrame', {frameId, action, params}); } @@ -141,10 +133,6 @@ const api = (() => { return this._invoke('clipboardGet'); } - clipboardGetImage() { - return this._invoke('clipboardGetImage'); - } - getDisplayTemplatesHtml() { return this._invoke('getDisplayTemplatesHtml'); }