When there is more than one lifeviewer on a page, the updateMe() doesn't work.
In this test case, I've created two lifeviewers, each with a single pixel set. Then, on window load,
I put a *horizontal* bar of six pixels in the *top* and a *vertical* bar of six pixels in the *bottom*.
What happens in the browser is the *top* viewer gets the *vertical* bar, and the *bottom* viewer
stays with a single pixel.
(When I do the same thing in reveal.js, I get similar behavior sometimes, but sometimes the
LifeViewers never load or display and the window.onload errors out.)
I suspect there's some race condition?
This one is a bit of a showstopper for me . . .
Code: Select all
<!DOCTYPE html>
<html>
<head>
<meta name="LifeViewer" content="viewer textarea"> <!--required tag-->
<script src="lv-plugin.js"></script> <!--assumes plug-in is in the same directory as html file-->
<script>
function update(id, dat) {
var el = document.getElementById(id);
el.innerHTML = dat;
updateMe(el);
}
window.onload = function() {
update('t1', 'oooooo');
update('t2', 'o$o$o$o$o$o$');
}
</script>
</head>
<body>
<!--viewer container-->
<div class="viewer"> <!--class=viewer is required-->
<textarea id="t1">o!</textarea><br/> <!--textarea required in viewer container, with glider rle-->
<canvas width=600 height=400></canvas> <!--canvas required in viewer container-->
</div>
<div class="viewer"> <!--class=viewer is required-->
<textarea id="t2">o!</textarea><br/> <!--textarea required in viewer container, with glider rle-->
<canvas width=600 height=400></canvas> <!--canvas required in viewer container-->
</div>
<!--end viewer container-->
</body>
</html>
More debugging of this: only the first viewer is ever updated, even if I add a button to the second viewer that calls updateMe(this).
(Edit). Not a showstopper; I just put my (rather large) RLE files inline and things work fine.