Skip to content

@mattetti /bug_reduction.html
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
bonsai.js bug reduction - running this script many times in a browser will behave differently
<!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
Something went wrong with that request. Please try again.