generated from akoskm/vite-react-tailwindcss-browser-extension
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbackground.ts
38 lines (31 loc) · 921 Bytes
/
background.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* This boilerplate code is currently not used in extension.
* You can enable background scripts by adding:
*
* "background": {
* "page": "background.html",
* "persistent": false
* },
*
* to the manifest.json file
*/
// import browser from "webextension-polyfill";
// type Message = {
// action: 'fetch',
// value: null
// }
// type ResponseCallback = (data: any) => void
// async function handleMessage({action, value}: Message, response: ResponseCallback) {
// if (action === 'fetch') {
// const result = await fetch('https://meowfacts.herokuapp.com/');
// const { data } = await result.json();
// response({ message: 'success', data });
// } else {
// response({data: null, error: 'Unknown action'});
// }
// }
// // @ts-ignore
// browser.runtime.onMessage.addListener((msg, sender, response) => {
// handleMessage(msg, response);
// return true;
// });