Phaser API Documentation

  Version: 
Filter
This is a beta release of our new docs system. Found an issue?
Please tell us about it in the #📖-newdocs-feedback channel on the Phaser Discord
Namespace: PluginCache
Phaser.Plugins.PluginCache

Methods

<static> register(key, plugin, mapping, [custom])
Focus
Focus

Description:

Static method called directly by the Core internal Plugins. Key is a reference used to get the plugin from the plugins object (i.e. InputPlugin) Plugin is the object to instantiate to create the plugin Mapping is what the plugin is injected into the Scene.Systems as (i.e. input)

Parameters:

name type arguments Default description
key string

A reference used to get this plugin from the plugin cache.

plugin function

The plugin to be stored. Should be the core object, not instantiated.

mapping string

If this plugin is to be injected into the Scene Systems, this is the property key map used.

custom boolean <optional> false

Core Scene plugin or a Custom Scene plugin?

Examples:
Since: 3.8.0
Focus
Focus
<static> registerCustom(key, plugin, mapping, data)
Focus
Focus

Description:

Stores a custom plugin in the global plugin cache. The key must be unique, within the scope of the cache.

Parameters:

name type description
key string

A reference used to get this plugin from the plugin cache.

plugin function

The plugin to be stored. Should be the core object, not instantiated.

mapping string

If this plugin is to be injected into the Scene Systems, this is the property key map used.

data any

A value to be passed to the plugin's init method.

Examples:
Since: 3.8.0
Focus
Focus
<static> hasCore(key)
Focus
Focus

Description:

Checks if the given key is already being used in the core plugin cache.

Parameters:

name type description
key string

The key to check for.

Returns:
Description:

true if the key is already in use in the core cache, otherwise false.

Type:
  • boolean
Examples:
Since: 3.8.0
Focus
Focus
<static> hasCustom(key)
Focus
Focus

Description:

Checks if the given key is already being used in the custom plugin cache.

Parameters:

name type description
key string

The key to check for.

Returns:
Description:

true if the key is already in use in the custom cache, otherwise false.

Type:
  • boolean
Examples:
Since: 3.8.0
Focus
Focus
<static> getCore(key)
Focus
Focus

Description:

Returns the core plugin object from the cache based on the given key.

Parameters:

name type description
key string

The key of the core plugin to get.

Returns:
Description:

The core plugin object.

Examples:
Since: 3.8.0
Focus
Focus
<static> getCustom(key)
Focus
Focus

Description:

Returns the custom plugin object from the cache based on the given key.

Parameters:

name type description
key string

The key of the custom plugin to get.

Returns:
Description:

The custom plugin object.

Examples:
Since: 3.8.0
Focus
Focus
<static> getCustomClass(key)
Focus
Focus

Description:

Returns an object from the custom cache based on the given key that can be instantiated.

Parameters:

name type description
key string

The key of the custom plugin to get.

Returns:
Description:

The custom plugin object.

Type:
  • function
Examples:
Since: 3.8.0
Focus
Focus
<static> remove(key)
Focus
Focus

Description:

Removes a core plugin based on the given key.

Parameters:

name type description
key string

The key of the core plugin to remove.

Examples:
Since: 3.8.0
Focus
Focus
<static> removeCustom(key)
Focus
Focus

Description:

Removes a custom plugin based on the given key.

Parameters:

name type description
key string

The key of the custom plugin to remove.

Examples:
Since: 3.8.0
Focus
Focus
<static> destroyCorePlugins()
Focus
Focus

Description:

Removes all Core Plugins.

This includes all of the internal system plugins that Phaser needs, like the Input Plugin and Loader Plugin. So be sure you only call this if you do not wish to run Phaser again.

Examples:
Since: 3.12.0
Focus
Focus
<static> destroyCustomPlugins()
Focus
Focus

Description:

Removes all Custom Plugins.

Examples:
Since: 3.12.0
Focus
Focus