Phaser API Documentation

  Version: 

Member of: Phaser.Time.Clock

addEvent(config)

Description:

Creates a Timer Event and adds it to this Clock at the start of the next frame.

You can pass in either a TimerEventConfig object, from with a new TimerEvent will be created, or you can pass in a TimerEvent instance.

If passing an instance please make sure that this instance hasn't been used before. If it has ever entered a 'completed' state then it will no longer be suitable to run again.

Also, if the TimerEvent instance is being used by another Clock (in another Scene) it will still be updated by that Clock as well, so be careful when using this feature.

Parameters:

name type description
config Phaser.Time.TimerEvent | Phaser.Types.Time.TimerEventConfig

The configuration for the Timer Event, or an existing Timer Event object.

Returns:
Description:

The Timer Event which was created, or passed in.

Since: 3.0.0
Source: src/time/Clock.js (Line 154)