File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -573,11 +573,14 @@ var PluginManager = new Class({
573573 * @since 3.8.0
574574 *
575575 * @param {string } key - The key of the plugin to get.
576+ * @param {boolean } [autoStart=true] - Automatically start a new instance of the plugin if found in the cache, but not actively running.
576577 *
577- * @return {?Phaser.Plugins.BasePlugin } The plugin, or `null` if no plugin was found matching the key.
578+ * @return {?( Phaser.Plugins.BasePlugin|function) } The plugin, or `null` if no plugin was found matching the key.
578579 */
579- get : function ( key )
580+ get : function ( key , autoStart )
580581 {
582+ if ( autoStart === undefined ) { autoStart = true ; }
583+
581584 var entry = this . getEntry ( key ) ;
582585
583586 if ( entry )
@@ -588,7 +591,7 @@ var PluginManager = new Class({
588591 {
589592 var plugin = this . getClass ( key ) ;
590593
591- if ( plugin )
594+ if ( plugin && autoStart )
592595 {
593596 var instance = new plugin ( this ) ;
594597
@@ -605,6 +608,10 @@ var PluginManager = new Class({
605608
606609 return instance ;
607610 }
611+ else if ( plugin )
612+ {
613+ return plugin ;
614+ }
608615 }
609616
610617 return null ;
You can’t perform that action at this time.
0 commit comments