Interface: GameEventsMap

Phaser.Types.Core. GameEventsMap

Methods


blur()

The Game Blur Event.

This event is dispatched by the Game Visibility Handler when the window in which the Game instance is embedded enters a blurred state. The blur event is raised when the window loses focus. This can happen if a user swaps tab, or if they simply remove focus from the browser to another app.

Since: 3.0.0
Source: src/core/events/BLUR_EVENT.js (Line 19)

boot()

The Game Boot Event.

This event is dispatched when the Phaser Game instance has finished booting, but before it is ready to start running. The global systems use this event to know when to set themselves up, dispatching their own ready events as required.

Since: 3.0.0
Source: src/core/events/BOOT_EVENT.js (Line 18)

contextlost()

The Game Context Lost Event.

This event is dispatched by the Game if the WebGL Renderer it is using encounters a WebGL Context Lost event from the browser.

The partner event is CONTEXT_RESTORED.

Since: 3.19.0
Source: src/core/events/CONTEXT_LOST_EVENT.js (Line 19)

contextrestored()

The Game Context Restored Event.

This event is dispatched by the Game if the WebGL Renderer it is using encounters a WebGL Context Restored event from the browser.

The partner event is CONTEXT_LOST.

Since: 3.19.0
Source: src/core/events/CONTEXT_RESTORED_EVENT.js (Line 19)

destroy()

The Game Destroy Event.

This event is dispatched when the game instance has been told to destroy itself. Lots of internal systems listen to this event in order to clear themselves out. Custom plugins and game code should also do the same.

Since: 3.0.0
Source: src/core/events/DESTROY_EVENT.js (Line 19)

focus()

The Game Focus Event.

This event is dispatched by the Game Visibility Handler when the window in which the Game instance is embedded enters a focused state. The focus event is raised when the window re-gains focus, having previously lost it.

Since: 3.0.0
Source: src/core/events/FOCUS_EVENT.js (Line 18)

hidden()

The Game Hidden Event.

This event is dispatched by the Game Visibility Handler when the document in which the Game instance is embedded enters a hidden state. Only browsers that support the Visibility API will cause this event to be emitted.

In most modern browsers, when the document enters a hidden state, the Request Animation Frame and setTimeout, which control the main game loop, will automatically pause. There is no way to stop this from happening. It is something your game should account for in its own code, should the pause be an issue (i.e. for multiplayer games)

Since: 3.0.0
Source: src/core/events/HIDDEN_EVENT.js (Line 22)

pause()

The Game Pause Event.

This event is dispatched when the Game loop enters a paused state, usually as a result of the Visibility Handler.

Since: 3.0.0
Source: src/core/events/PAUSE_EVENT.js (Line 17)

postrender(renderer)

The Game Post-Render Event.

This event is dispatched right at the end of the render process.

Every Scene will have rendered and been drawn to the canvas by the time this event is fired. Use it for any last minute post-processing before the next game step begins.

Parameters:
Name Type Description
renderer Phaser.Renderer.Canvas.CanvasRenderer | Phaser.Renderer.WebGL.WebGLRenderer

A reference to the current renderer being used by the Game instance.

Since: 3.0.0
Source: src/core/events/POST_RENDER_EVENT.js (Line 22)

poststep(time, delta)

The Game Post-Step Event.

This event is dispatched after the Scene Manager has updated. Hook into it from plugins or systems that need to do things before the render starts.

Parameters:
Name Type Description
time number

The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout.

delta number

The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate.

Since: 3.0.0
Source: src/core/events/POST_STEP_EVENT.js (Line 21)

prerender(renderer)

The Game Pre-Render Event.

This event is dispatched immediately before any of the Scenes have started to render.

The renderer will already have been initialized this frame, clearing itself and preparing to receive the Scenes for rendering, but it won't have actually drawn anything yet.

Parameters:
Name Type Description
renderer Phaser.Renderer.Canvas.CanvasRenderer | Phaser.Renderer.WebGL.WebGLRenderer

A reference to the current renderer being used by the Game instance.

Since: 3.0.0
Source: src/core/events/PRE_RENDER_EVENT.js (Line 21)

prestep(time, delta)

The Game Pre-Step Event.

This event is dispatched before the main Game Step starts. By this point in the game cycle none of the Scene updates have yet happened. Hook into it from plugins or systems that need to update before the Scene Manager does.

Parameters:
Name Type Description
time number

The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout.

delta number

The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate.

Since: 3.0.0
Source: src/core/events/PRE_STEP_EVENT.js (Line 21)

ready()

The Game Ready Event.

This event is dispatched when the Phaser Game instance has finished booting, the Texture Manager is fully ready, and all local systems are now able to start.

Since: 3.0.0
Source: src/core/events/READY_EVENT.js (Line 18)

resume()

The Game Resume Event.

This event is dispatched when the game loop leaves a paused state and resumes running.

Since: 3.0.0
Source: src/core/events/RESUME_EVENT.js (Line 17)

step(time, delta)

The Game Step Event.

This event is dispatched after the Game Pre-Step and before the Scene Manager steps. Hook into it from plugins or systems that need to update before the Scene Manager does, but after the core Systems have.

Parameters:
Name Type Description
time number

The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout.

delta number

The delta time in ms since the last frame. This is a smoothed and capped value based on the FPS rate.

Since: 3.0.0
Source: src/core/events/STEP_EVENT.js (Line 21)

visible()

The Game Visible Event.

This event is dispatched by the Game Visibility Handler when the document in which the Game instance is embedded enters a visible state, previously having been hidden.

Only browsers that support the Visibility API will cause this event to be emitted.

Since: 3.0.0
Source: src/core/events/VISIBLE_EVENT.js (Line 20)