Signal
Class: Phaser.Signal
Constructor
new Signal()
Signals are what Phaser uses to handle events and event dispatching.
You can listen for a Signal by binding a callback / function to it.
This is done by using either Signal.add
or Signal.addOnce
.
For example you can listen for a touch or click event from the Input Manager
by using its onDown
Signal:
game.input.onDown.add(function() { ... });
Rather than inline your function, you can pass a reference:
game.input.onDown.add(clicked, this);
function clicked () { ... }
In this case the second argument (this
) is the context in which your function should be called.
Now every time the InputManager dispatches the onDown
signal (or event), your function
will be