Move apiScreenshotGet implementation into Backend

This commit is contained in:
toasted-nutbread 2019-12-09 21:54:03 -05:00
parent 1202ad261e
commit d8b21606ba
2 changed files with 9 additions and 9 deletions

View File

@ -74,14 +74,7 @@ function apiAudioGetUrl(definition, source, optionsContext) {
}
function apiScreenshotGet(options, sender) {
if (!(sender && sender.tab)) {
return Promise.resolve();
}
const windowId = sender.tab.windowId;
return new Promise((resolve) => {
chrome.tabs.captureVisibleTab(windowId, options, (dataUrl) => resolve(dataUrl));
});
return utilBackend()._onApiScreenshotGet({options}, sender);
}
function apiForward(action, params, sender) {

View File

@ -409,7 +409,14 @@ class Backend {
}
_onApiScreenshotGet({options}, sender) {
return apiScreenshotGet(options, sender);
if (!(sender && sender.tab)) {
return Promise.resolve();
}
const windowId = sender.tab.windowId;
return new Promise((resolve) => {
chrome.tabs.captureVisibleTab(windowId, options, (dataUrl) => resolve(dataUrl));
});
}
_onApiForward({action, params}, sender) {