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:
beeglebug
2013-10-27 22:30:01 +00:00
parent 9261160571
commit f00c52598b
+7
View File
@@ -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