summaryrefslogtreecommitdiff
path: root/src/background/index.js
blob: 9c97c9d8b8ca25f5f1e95d12473a02ab261eca02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/**
 * Background entry point (Firefox MV3 event page, ES module).
 *
 * All event listeners are registered synchronously at the top level so the
 * event page can be woken by any of them (MDN: background scripts).
 */

import { registerRuntimeMessageHandler, handleConnection } from './message-router.js';
import { loadSettings, watchSettings } from './settings-service.js';

// One-shot messages from popup / options.
registerRuntimeMessageHandler();

// Streaming connections from the content script.
browser.runtime.onConnect.addListener(handleConnection);

// Keep the validated settings cache in sync and load initial settings.
watchSettings();
void loadSettings();