Move apiForward implementation into Backend

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

View File

@ -78,14 +78,7 @@ function apiScreenshotGet(options, sender) {
}
function apiForward(action, params, sender) {
if (!(sender && sender.tab)) {
return Promise.resolve();
}
const tabId = sender.tab.id;
return new Promise((resolve) => {
chrome.tabs.sendMessage(tabId, {action, params}, (response) => resolve(response));
});
return utilBackend()._onApiForward({action, params}, sender);
}
function apiFrameInformationGet(sender) {

View File

@ -420,7 +420,14 @@ class Backend {
}
_onApiForward({action, params}, sender) {
return apiForward(action, params, sender);
if (!(sender && sender.tab)) {
return Promise.resolve();
}
const tabId = sender.tab.id;
return new Promise((resolve) => {
chrome.tabs.sendMessage(tabId, {action, params}, (response) => resolve(response));
});
}
_onApiFrameInformationGet(params, sender) {