bonsai.js bug reduction - running this script many times in a browser will behave differently
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en" class=" -webkit-"> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0;"> | |
<title>Demo</title> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/bonsai/0.4.1/bonsai.min.js"></script> | |
</head> | |
<body> | |
<div id="movie1"></div> | |
<div id="movie2"></div> | |
</body> | |
<script> | |
var movie = bonsai.run(document.getElementById('movie1'), { | |
code: function() { | |
stage.on('message', function(data) { | |
new Rect(10, 10, 100, 100) | |
.fill('yellow') | |
.stroke('#f00', 2) | |
.addTo(stage); | |
}); | |
}, | |
width: 400, | |
height: 400, | |
}); | |
var movie2 = bonsai.run(document.getElementById('movie2'), { | |
code: function(){}, | |
width: 400, | |
height: 400, | |
}); | |
movie2.on('load', function() { | |
movie.sendMessage({ foo: "bar" }); | |
}); | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment