Set up a callback system for the browser link.

This should somewhat simulate asynchronous method calling.
This commit is contained in:
Markil3
2021-07-26 22:53:44 -07:00
parent 66ce116da4
commit b89dd9783a
4 changed files with 491 additions and 172 deletions

View File

@@ -9,12 +9,5 @@ Listen for messages from the app.
*/
port.onMessage.addListener((response) => {
console.log("Received: " + response);
port.postMessage("pong");
});
/*
On a click on the browser action, send the app a message.
*/
browser.browserAction.onClicked.addListener(() => {
console.log("Sending: ping");
port.postMessage("ping");
});