Remove unused api functions (#1354)
* Remove screenshotGet * Remove downloadDefinitionAudio * Remove clipboardGetImage
This commit is contained in:
parent
73e91b3b62
commit
bb8a521dff
@ -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');
|
||||
}
|
||||
|
@ -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');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user