mirror of
https://github.com/Qortal/chrome-extension.git
synced 2025-02-11 17:55: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...
|
||||
});
|
||||
|
||||
|
||||
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
|
||||
console.error(chrome.runtime.lastError.message);
|
||||
} else {
|
||||
chrome.tabs.query({}, function(tabs) {
|
||||
tabs.forEach(tab => {
|
||||
console.log({tab})
|
||||
chrome.tabs.sendMessage(tab.id, { type: "LOGOUT" });
|
||||
});
|
||||
});
|
||||
// Data removed successfully
|
||||
sendResponse(true);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user