-
Notifications
You must be signed in to change notification settings - Fork 1
/
background.js
50 lines (38 loc) · 1.04 KB
/
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
44
45
46
47
48
49
50
// setInterval(checkCookies, 10 * 1000)
/*
chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
console.log(tabId, changeInfo, tab.url, tab.title, tab.openerTabId)
})
function checkCookies() {
chrome.cookies.get({
url: 'https://familysearch.org/',
name: 'fssessionid',
}, function (cookie) {
if (!cookie) return
})
}
chrome.runtime.onMessageExternal.addListener(
function(request, sender, sendResponse) {
sendResponse('wat')
chrome.cookies.get({
url: 'https://familysearch.org/',
name: 'fssessionid',
}, function (cookie) {
sendResponse(cookie ? cookie.value : null)
});
});
chrome.runtime.onConnectExternal.addListener(function (port) {
var _int = setInterval(checkCookies, 1 * 1000)
function checkCookies() {
chrome.cookies.get({
url: 'https://familysearch.org/',
name: 'fssessionid',
}, function (cookie) {
if (!cookie) return port.postMessage(null)
clearInterval(_int)
port.postMessage(cookie.value)
})
}
checkCookies()
});
*/