phaser/examples/signals.html
2013-08-28 07:02:57 +01:00

35 lines
No EOL
774 B
HTML

<!DOCTYPE HTML>
<html>
<head>
<title>phaser.js - a(nother) new beginning</title>
<script src="../src/Phaser.js"></script>
<script src="../src/core/SignalBinding.js"></script>
<script src="../src/core/Signal.js"></script>
<script src="../src/math/RandomDataGenerator.js"></script>
<script src="../src/Game.js"></script>
</head>
<body>
<script type="text/javascript">
function action(aString, aNumber, aObject) {
console.log('Signal received:', aString, aNumber, aObject);
}
var game = new Phaser.Game(this, '', 800, 600);
// create a new signal
var s = new Phaser.Signal();
// add a listener to it (the 'action' function)
s.add(action, this);
// dispatch it with some parameters
s.dispatch('Atari forever', 520, { x: 100, y: 200 });
</script>
</body>
</html>