Functions can be connected to the signal object, after which they will get
called when the signal is emitted. The tiled module provides several
useful signals, like tiled.assetAboutToBeSaved.
Properties usually will have related signals which can be used to detect
changes to that property, but most of those are currently not implemented.
To connect to a signal, call its connect function and
pass in a function object. In the following example, newly created maps
automatically get their first tile layer removed:
In some cases it will be necessary to later disconnect the function from
the signal again. This can be done by defining the function separately
and passing it into the disconnect function:
functiononAssetCreated(asset) {// Do something...}tiled.assetCreated.connect(onAssetCreated)// ...tiled.assetCreated.disconnect(onAssetCreated)
An object representing an event.
Functions can be connected to the signal object, after which they will get called when the signal is emitted. The tiled module provides several useful signals, like tiled.assetAboutToBeSaved.
Properties usually will have related signals which can be used to detect changes to that property, but most of those are currently not implemented.
To connect to a signal, call its connect function and pass in a function object. In the following example, newly created maps automatically get their first tile layer removed:
In some cases it will be necessary to later disconnect the function from the signal again. This can be done by defining the function separately and passing it into the disconnect function: