From 5b6e323a90b39f76f54fe6efa8b8f8d699e4501e Mon Sep 17 00:00:00 2001 From: Henri Bergius Date: Wed, 26 Dec 2018 21:10:10 +0100 Subject: [PATCH] Rotate immediately if waitUntil is in the past --- infodisplay/infodisplay.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/infodisplay/infodisplay.js b/infodisplay/infodisplay.js index 5f1364a..406c6c7 100644 --- a/infodisplay/infodisplay.js +++ b/infodisplay/infodisplay.js @@ -85,13 +85,16 @@ function DisplayParticipant(broker, role, defaultUrls, timer) { window.onmessage = null; const now = new Date(); if (!event.data - || !event.data.waitUntil - || event.data.waitUntil < now.getTime()) { + || !event.data.waitUntil) { return; } if (timeout) { clearTimeout(timeout); } + if (event.data.waitUntil < now.getTime()) { + participant.send('open', getRotationUrl(urls, indata)); + return; + } timeout = setTimeout(() => { participant.send('open', getRotationUrl(urls, indata)); }, event.data.waitUntil - now.getTime());