Files
bulk-delete-chatGPT/background.js
2024-07-11 13:26:08 +08:00

22 lines
666 B
JavaScript

console.log("Background script loaded");
chrome.runtime.onInstalled.addListener(() => {
console.log("Extension installed");
});
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
if (request.action === "getUserInfo") {
chrome.identity.getProfileUserInfo({ accountStatus: "ANY" }, (userInfo) => {
if (chrome.runtime.lastError) {
console.error(chrome.runtime.lastError);
sendResponse({ error: chrome.runtime.lastError.message });
} else {
sendResponse({ userInfo: userInfo });
}
});
return true; // Will respond asynchronously
}
});
console.log("Background script setup complete");