53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
}
catch (e) {
showError(e);
}
}
function handleResponse(message) {
console.log(`background script sent a response: ${message.response}`);
}
function handleError(error) {
console.log(`Error: ${error}`);
}
function sendMessage (sMessage) {
let sending = browser.runtime.sendMessage({content: sMessage});
sending.then(handleResponse, handleError);
}
|
|
|
|
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
}
catch (e) {
showError(e);
}
}
function handleResponse(message) {
console.log(`[Panel] received: ${message.response}`);
}
function handleError(error) {
console.log(`[Panel] Error: ${error}`);
}
function sendMessage (sMessage) {
let sending = browser.runtime.sendMessage({content: sMessage});
sending.then(handleResponse, handleError);
}
|