Commit 5281790c by Justin Riley

clear javascript timer after access granted

parent 28a48e58
...@@ -73,6 +73,10 @@ procrel = (function(){ ...@@ -73,6 +73,10 @@ procrel = (function(){
do_pp_get('status', function(data){ do_pp_get('status', function(data){
console.log(data); console.log(data);
if (data.enabled) { if (data.enabled) {
if (timeout != null) {
console.log("Disabling timer");
clearTimeout(timeout);
}
alert ("Access Granted!"); alert ("Access Granted!");
location.reload(); location.reload();
} }
...@@ -81,10 +85,12 @@ procrel = (function(){ ...@@ -81,10 +85,12 @@ procrel = (function(){
var check_count = 0; var check_count = 0;
var timeout = null;
var periodic_check = function() { var periodic_check = function() {
check_count = check_count + 1; check_count = check_count + 1;
if (check_count < 100){ // > if (check_count < 100){ // >
setTimeout(periodic_check, 2000); timeout = setTimeout(periodic_check, 2000);
} }
check_access(); check_access();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment