summaryrefslogtreecommitdiff
path: root/modules/changes/changes.js
diff options
context:
space:
mode:
Diffstat (limited to 'modules/changes/changes.js')
-rw-r--r--modules/changes/changes.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/changes/changes.js b/modules/changes/changes.js
index 9c536b3..c3f24af 100644
--- a/modules/changes/changes.js
+++ b/modules/changes/changes.js
@@ -81,11 +81,12 @@ function fetch(method,url,data/*?*/,cb){
req.end();
}
+var refresh_persist_timeout=null;
+
function refreshURLs(){
var hashes={};
var i;
var url;
- var timeout=null;
for(url in urls){
console.log("Fetching <"+url+">");
fetch("GET",url,function(url,status,body){
@@ -107,10 +108,11 @@ function refreshURLs(){
urls[url].timeline.push(hashes[url]);
//}
- if(timeout)clearTimeout(timeout);
- timeout=setTimeout(function(){
+ if(refresh_persist_timeout!=null)clearTimeout(refresh_persist_timeout);
+ refresh_persist_timeout=setTimeout(function(){
persist.setItemSync("urls",urls);
console.log("(persisted after refresh)")
+ refresh_persist_timeout=null;
},2000);
}.bind(null,url));
}