Move apiScreenshotGet implementation into Backend
This commit is contained in:
parent
1202ad261e
commit
d8b21606ba
@ -74,14 +74,7 @@ function apiAudioGetUrl(definition, source, optionsContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function apiScreenshotGet(options, sender) {
|
function apiScreenshotGet(options, sender) {
|
||||||
if (!(sender && sender.tab)) {
|
return utilBackend()._onApiScreenshotGet({options}, sender);
|
||||||
return Promise.resolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
const windowId = sender.tab.windowId;
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
chrome.tabs.captureVisibleTab(windowId, options, (dataUrl) => resolve(dataUrl));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function apiForward(action, params, sender) {
|
function apiForward(action, params, sender) {
|
||||||
|
@ -409,7 +409,14 @@ class Backend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_onApiScreenshotGet({options}, sender) {
|
_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) {
|
_onApiForward({action, params}, sender) {
|
||||||
|
Loading…
Reference in New Issue
Block a user