mirror of
https://github.com/lil-org/tokenary.git
synced 2025-01-07 14:10:28 +03:00
Just show app when content script is not there
This commit is contained in:
parent
102d6959fd
commit
dbe7512750
@ -108,13 +108,22 @@ function storeConfigurationIfNeeded(host, response) {
|
||||
}
|
||||
}
|
||||
|
||||
function justShowApp() {
|
||||
const id = genId();
|
||||
const showAppMessage = {name: "justShowApp", id: id, provider: "unknown", body: {}, host: ""};
|
||||
browser.runtime.sendNativeMessage("mac.tokenary.io", showAppMessage);
|
||||
}
|
||||
|
||||
browser.browserAction.onClicked.addListener(function(tab) {
|
||||
const message = {didTapExtensionButton: true};
|
||||
browser.tabs.sendMessage(tab.id, message);
|
||||
browser.tabs.sendMessage(tab.id, message, function(pong) {
|
||||
if (pong != true) {
|
||||
justShowApp();
|
||||
}
|
||||
});
|
||||
|
||||
if (tab.url == "" && tab.pendingUrl == "") {
|
||||
const id = genId();
|
||||
const showAppMessage = {name: "justShowApp", id: id, provider: "unknown", body: {}, host: ""};
|
||||
browser.runtime.sendNativeMessage("mac.tokenary.io", showAppMessage);
|
||||
justShowApp();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -119,6 +119,7 @@ function didTapExtensionButton() {
|
||||
// Receive from background
|
||||
browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
||||
if ("didTapExtensionButton" in request) {
|
||||
sendResponse(true);
|
||||
didTapExtensionButton();
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user