blob: 099b5fbe279b73b27d19ca72ae509f7027c80d1a (
plain) (
blame)
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
|
function check_reclaim() {
var xmlHttp = new XMLHttpRequest();
xmlHttp.open('GET', 'http://localhost:7776/identity/all', true);
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == XMLHttpRequest.DONE) {
var resp = xmlHttp.responseText;
var re = new RegExp('^\\[[a-zA-Z0-9"{}: ,]*\\]$');
var OK = re.test(resp);
if (!OK) {
var reclaim_alive = false;
chrome.storage.local.set({reclaim_alive}, function() {});
console.log("reclaim down");
} else {
var reclaim_alive = true;
chrome.storage.local.set({reclaim_alive}, function() {});
console.log("reclaim up");
}
}
}
try {
xmlHttp.send(null);
} catch(e) {
console.log(e);
}
}
check_reclaim();
var intervalId = setInterval(check_reclaim, 5000);
|