File size: 749 Bytes
7dbf557
 
 
 
 
dfa4a77
7dbf557
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
intervalBegin()


function intervalBegin(){
    // minutes= min *60*1000
    intervalAPI= setInterval( getRefreshAPIAjax ,1800000) // 30*60*1000 // every 30 min 

}

function getRefreshAPIAjax(){

      ajax('/RetrieveMCTNames/')
      .then(function(data) {
        MCTNames=JSON.parse(data);
        self.postMessage(MCTNames); // Code depending on result  
      })
    }

      
function ajax(url) { //sectionData
    return new Promise(function(resolve, reject) {
      var xhr = new XMLHttpRequest();
      xhr.onload = function() {
        resolve(this.responseText);
      };
      xhr.onerror = reject;
      
      xhr.open('GET', url)//+'?jsdata=' + jsdata);
      xhr.send();
    });
}

/*Retrieve MCTNAMES Dictionary from API - Flask*/