Namespace: PluginCache

Phaser.Plugins. PluginCache

Methods


<static> destroyCorePlugins()

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.

Since: 3.12.0
Source: src/plugins/PluginCache.js (Line 166)

<static> destroyCustomPlugins()

Removes all Custom Plugins.

Since: 3.12.0
Source: src/plugins/PluginCache.js (Line 186)

<static> getCore(key)

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.

Since: 3.8.0
Source: src/plugins/PluginCache.js (Line 89)
Returns:

The core plugin object.

Type
Phaser.Types.Plugins.CorePluginContainer

<static> getCustom(key)

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.

Since: 3.8.0
Source: src/plugins/PluginCache.js (Line 104)
Returns:

The custom plugin object.

Type
Phaser.Types.Plugins.CustomPluginContainer

<static> getCustomClass(key)

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.

Since: 3.8.0
Source: src/plugins/PluginCache.js (Line 119)
Returns:

The custom plugin object.

Type
function

<static> hasCore(key)

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.

Since: 3.8.0
Source: src/plugins/PluginCache.js (Line 59)
Returns:

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

Type
boolean

<static> hasCustom(key)

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.

Since: 3.8.0
Source: src/plugins/PluginCache.js (Line 74)
Returns:

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

Type
boolean

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

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 Argument 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?

Since: 3.8.0
Source: src/plugins/PluginCache.js (Line 21)

<static> registerCustom(key, plugin, mapping, data)

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

Parameters:
Name Type Argument 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 <nullable>

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

Since: 3.8.0
Source: src/plugins/PluginCache.js (Line 42)

<static> remove(key)

Removes a core plugin based on the given key.

Parameters:
Name Type Description
key string

The key of the core plugin to remove.

Since: 3.8.0
Source: src/plugins/PluginCache.js (Line 134)

<static> removeCustom(key)

Removes a custom plugin based on the given key.

Parameters:
Name Type Description
key string

The key of the custom plugin to remove.

Since: 3.8.0
Source: src/plugins/PluginCache.js (Line 150)