mirror of
https://github.com/icecoder/ICEcoder.git
synced 2026-03-05 00:04:00 +01:00
Send TS if we have one, only update changed data
This commit is contained in:
@@ -148,13 +148,18 @@ var ICEcoder = {
|
||||
if (!top.ICEcoder.indexing && !top.ICEcoder.loadingFile && top.ICEcoder.serverQueueItems.length === 0 && top.ICEcoder.openSeconds % 3 == 0) {
|
||||
top.ICEcoder.indexing = true;
|
||||
// Get new data
|
||||
fetch('lib/indexer.php')
|
||||
var timestampExtra = top.ICEcoder.indexData
|
||||
? "?timestamp="+top.ICEcoder.indexData.timestamps.indexed+"&csrf="+top.ICEcoder.csrf
|
||||
: "";
|
||||
fetch('lib/indexer.php'+timestampExtra)
|
||||
.then(function(response) {
|
||||
// Convert to JSON
|
||||
return response.json();
|
||||
}).then(function(data) {
|
||||
top.ICEcoder.indexData = data;
|
||||
top.ICEcoder.indexing = false;
|
||||
if (data.timestamps.changed) {
|
||||
top.ICEcoder.indexData = data;
|
||||
}
|
||||
top.ICEcoder.indexing = false;
|
||||
});
|
||||
}
|
||||
},1000);
|
||||
|
||||
Reference in New Issue
Block a user