mirror of
https://github.com/Qortal/chrome-extension.git
synced 2025-02-12 02:05:49 +00:00
event for logout
This commit is contained in:
parent
891d7a3529
commit
aaf6a68dc7
@ -180,3 +180,15 @@ document.addEventListener('qortalExtensionRequests', async (event) => {
|
|||||||
}
|
}
|
||||||
// Handle other request types as needed...
|
// Handle other request types as needed...
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) {
|
||||||
|
console.log({message})
|
||||||
|
if (message.type === "LOGOUT") {
|
||||||
|
// Notify the web page
|
||||||
|
window.postMessage({
|
||||||
|
type: "LOGOUT",
|
||||||
|
from: 'qortal'
|
||||||
|
}, "*");
|
||||||
|
}
|
||||||
|
});
|
@ -811,6 +811,12 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
|||||||
// Handle error
|
// Handle error
|
||||||
console.error(chrome.runtime.lastError.message);
|
console.error(chrome.runtime.lastError.message);
|
||||||
} else {
|
} else {
|
||||||
|
chrome.tabs.query({}, function(tabs) {
|
||||||
|
tabs.forEach(tab => {
|
||||||
|
console.log({tab})
|
||||||
|
chrome.tabs.sendMessage(tab.id, { type: "LOGOUT" });
|
||||||
|
});
|
||||||
|
});
|
||||||
// Data removed successfully
|
// Data removed successfully
|
||||||
sendResponse(true);
|
sendResponse(true);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user