f09148640c
This fixes an incompatibility of the "latest image" server-side event system with Firefox. Firefox really want to have an immediate event on the SSE channel, or it'll think that the connection wasn't made properly.
16 lines
565 B
JavaScript
16 lines
565 B
JavaScript
var source = new EventSource('/imagewatch');
|
|
|
|
source.addEventListener('image', function (event) {
|
|
var filename = event.data;
|
|
if (console) console.log(filename);
|
|
|
|
var url = '/static/' + filename + '?' + new Date().getTime();
|
|
$('#last_rendered_image').attr('src', url);
|
|
$('body.imageviewer').css('background-image', 'url(' + url + ')');
|
|
}, false);
|
|
|
|
// For debugging purposes this can be handy:
|
|
// source.addEventListener('notification', function (event) {
|
|
// console.log("Received notification from image watcher:", event.data);
|
|
// }, false);
|