From b244ef0093b769f6efbe64bf3f508c9a93d33372 Mon Sep 17 00:00:00 2001 From: murtaugh Date: Thu, 28 May 2020 11:43:54 +0200 Subject: [PATCH] Update '12/liveplayer.js' --- 12/liveplayer.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/12/liveplayer.js b/12/liveplayer.js index cefa378..529b68c 100644 --- a/12/liveplayer.js +++ b/12/liveplayer.js @@ -1,9 +1,16 @@ (function () { - +var last_timestamp; async function poll () { - var d = await (await fetch("/cgi-bin/radioimplicancies.cgi")).json(); - console.log("d", d); + var rows = await (await fetch("/cgi-bin/radioimplicancies.cgi")).json(); + console.log("rows", rows); + if (rows) { + // get the last (most recent) item + var d = rows[rows.length-1]; + if (d.time && d.time != last_timestamp) { + console.log("CURRENT METADATA", d); + last_timestamp = d.time; + } } window.setInterval(poll, 5000);