mirror of
https://github.com/wassname/phaser.git
synced 2026-07-15 01:11:26 +08:00
added init method to plugins
this will allow potentially destructive code to run outside of the constructor, and only if it has been added to the PluginManager
This commit is contained in:
@@ -103,6 +103,13 @@ Phaser.PluginManager.prototype = {
|
||||
}
|
||||
|
||||
this._pluginsLength = this.plugins.push(plugin);
|
||||
|
||||
// Allows plugins to run potentially destructive code outside of the constructor, and only if being added to the PluginManager
|
||||
if (typeof plugin['init'] === 'function')
|
||||
{
|
||||
plugin.init();
|
||||
}
|
||||
|
||||
return plugin;
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user