Lesss gooo claude
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { getLockState, setLockState } from '@/background/lock-state';
|
||||
import type { NexaMessage } from '@/shared/messaging';
|
||||
|
||||
export default defineBackground(() => {
|
||||
browser.runtime.onMessage.addListener((message: NexaMessage, _sender, sendResponse) => {
|
||||
switch (message?.type) {
|
||||
case 'nexa:get-lock-state':
|
||||
getLockState().then(sendResponse);
|
||||
return true; // keep the message channel open for the async response
|
||||
|
||||
case 'nexa:set-lock-state':
|
||||
setLockState(message.state).then(() => sendResponse({ ok: true }));
|
||||
return true;
|
||||
|
||||
case 'nexa:open-popup':
|
||||
// Best-effort: not all browsers/contexts allow programmatic popup
|
||||
// opening outside a direct user gesture on the action icon.
|
||||
browser.action.openPopup().catch(() => undefined);
|
||||
return false;
|
||||
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user