Skip to content

Commit f00c525

Browse files
committed
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
1 parent 9261160 commit f00c525

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/core/PluginManager.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@ Phaser.PluginManager.prototype = {
103103
}
104104

105105
this._pluginsLength = this.plugins.push(plugin);
106+
107+
// Allows plugins to run potentially destructive code outside of the constructor, and only if being added to the PluginManager
108+
if (typeof plugin['init'] === 'function')
109+
{
110+
plugin.init();
111+
}
112+
106113
return plugin;
107114
}
108115
else

0 commit comments

Comments
 (0)