-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscratchpad.js
45 lines (40 loc) · 966 Bytes
/
scratchpad.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
44
45
// scratchpad.js -- NOTES AND CASSEROLE CODE
/**
* LISTEN TO BROWSER ACTIONS
*/
// listen to tab URL changes
browser.tabs.onUpdated.addListener(updateActiveTab);
// listen to tab switching
browser.tabs.onActivated.addListener(updateActiveTab);
// listen for window switching
browser.windows.onFocusChanged.addListener(updateActiveTab);
/**
* IFRAMES
*/
// couldn't find a video, try to find iframes
var myFrame = document.querySelector('iframe');
/**
* DEBOUNCE FUNCTION
*/
function debounce(callback) {
if (timer) {
clearTimeout(timer)
timer = setTimeout(() => {
callback()
timer = undefined
}, time)
return
}
callback()
timer = setTimeout(() => {
timer = undefined
}, time)
return
}
/**
* BROWSER STORAGE
*/
const browserStorage = browser.storage.local;
browserStorage.set({ mirrorCheckbox: 'on' });
initialize();
const storedValues = await browserStorage.get();