mirror of
https://github.com/ryanamay/fnaf-jumpscare.git
synced 2024-09-20 01:40:35 +00:00
10 lines
No EOL
410 B
JavaScript
10 lines
No EOL
410 B
JavaScript
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
|
if (message.action === 'checkFocus') {
|
|
chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => {
|
|
const focusedTabId = tabs[0].id;
|
|
sendResponse({ isFocused: sender.tab.id === focusedTabId });
|
|
});
|
|
// Keep the message channel open until sendResponse is called
|
|
return true;
|
|
}
|
|
}); |