Skip to content

Commit 75db482

Browse files
committed
Added destroyCustomPlugin and destroyCorePlugin
1 parent 3d23013 commit 75db482

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

src/plugins/PluginCache.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,4 +174,41 @@ PluginCache.removeCustom = function (key)
174174
}
175175
};
176176

177+
/**
178+
* Removes all Core Plugins.
179+
*
180+
* This includes all of the internal system plugins that Phaser needs, like the Input Plugin and Loader Plugin.
181+
* So be sure you only call this if you do not wish to run Phaser again.
182+
*
183+
* @method Phaser.Plugins.PluginCache.destroyCorePlugins
184+
* @since 3.12.0
185+
*/
186+
PluginCache.destroyCorePlugins = function ()
187+
{
188+
for (var key in corePlugins)
189+
{
190+
if (corePlugins.hasOwnProperty(key))
191+
{
192+
delete corePlugins[key];
193+
}
194+
}
195+
};
196+
197+
/**
198+
* Removes all Custom Plugins.
199+
*
200+
* @method Phaser.Plugins.PluginCache.destroyCustomPlugins
201+
* @since 3.12.0
202+
*/
203+
PluginCache.destroyCustomPlugins = function ()
204+
{
205+
for (var key in customPlugins)
206+
{
207+
if (customPlugins.hasOwnProperty(key))
208+
{
209+
delete customPlugins[key];
210+
}
211+
}
212+
};
213+
177214
module.exports = PluginCache;

0 commit comments

Comments
 (0)