forked from LiamHarrison25/Jambofy-Extension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
background.js
43 lines (39 loc) · 817 Bytes
/
background.js
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
39
40
41
42
43
// let data =
// {
// "event": "onEnable/onDisable",
// "prefs":
// {
// "opacity": '100'
// }
// }
chrome.runtime.onMessage.addListener(data =>
{
const { prefs } = data
switch (data.event)
{
case 'onEnable':
handleOnEnable();
break;
case 'onDisable':
handleOnDisable();
break;
case 'onSwitchOpacity':
handleOnSwitchOpacity(prefs);
break;
default:
break;
}
})
const handleOnEnable = () =>
{
console.log("Enabled")
}
const handleOnDisable = () =>
{
console.log("Disabled")
}
const handleOnSwitchOpacity = (prefs) =>
{
console.log("prefs for opacity received: ", prefs)
chrome.storage.local.set(prefs)
}