mirror of
https://github.com/lil-org/tokenary.git
synced 2024-12-15 06:56:34 +03:00
20 lines
765 B
JavaScript
20 lines
765 B
JavaScript
browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
|
if (request.subject === "process-inpage-message") {
|
|
browser.runtime.sendNativeMessage("mac.tokenary.io", request.message, function(response) {
|
|
sendResponse(response)
|
|
});
|
|
}
|
|
return true;
|
|
});
|
|
|
|
browser.browserAction.onClicked.addListener(function(tab) {
|
|
const id = new Date().getTime() + Math.floor(Math.random() * 1000);
|
|
const request = {id: id, name: "switchAccount", object: {}, address: ""};
|
|
// TODO: pass current network id
|
|
// TODO: pass favicon
|
|
// TODO: pass host here as well
|
|
browser.runtime.sendNativeMessage("mac.tokenary.io", request, function(response) {
|
|
browser.tabs.sendMessage(tab.id, response);
|
|
});
|
|
});
|