Remove load listener after ready

This commit is contained in:
Henri Bergius 2017-11-29 18:14:37 +01:00
parent 84837f602a
commit a20e9a7c6e

View file

@ -50,6 +50,7 @@ function DisplayParticipant(broker, role, defaultUrls, timer) {
// Update URL listing // Update URL listing
urls = indata; urls = indata;
callback('urls', null, urls); callback('urls', null, urls);
return;
} }
if (next.getAttribute('src') === indata) { if (next.getAttribute('src') === indata) {
// Already open! // Already open!
@ -86,7 +87,8 @@ function DisplayParticipant(broker, role, defaultUrls, timer) {
return participant; return participant;
} }
window.addEventListener('load', () => { function onPageReady() {
window.removeEventListener('load', onPageReady, false);
const params = msgflo.options({ const params = msgflo.options({
broker: 'mqtt://c-beam.cbrp3.c-base.org:1882', broker: 'mqtt://c-beam.cbrp3.c-base.org:1882',
role: 'infodisplay', role: 'infodisplay',
@ -103,4 +105,5 @@ window.addEventListener('load', () => {
} }
p.send('open', getRotationUrl(params.urls)); p.send('open', getRotationUrl(params.urls));
}); });
}, false); }
window.addEventListener('load', onPageReady, false);