Extensão do Chrome SendMessage Wait até GetData
/**
* Promise wrapper for chrome.tabs.sendMessage
* @param tabId
* @param item
* @returns {Promise<any>}
*/
function sendMessagePromise(tabId, item) {
return new Promise((resolve, reject) => {
chrome.tabs.sendMessage(tabId, {item}, response => {
if(response.complete) {
resolve();
} else {
reject('Something wrong');
}
});
});
}
Wicked Worm