Skip to content

Commit 5da7707

Browse files
committed
PluginManager.install returns null if the plugin failed to install in all cases.
1 parent 7e206cf commit 5da7707

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/plugins/PluginManager.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,8 @@ var PluginManager = new Class({
406406
* @param {boolean} [start=false] - Automatically start the plugin running? This is always `true` if you provide a mapping value.
407407
* @param {string} [mapping] - If this plugin is injected into the Phaser.Scene class, this is the property key to use.
408408
* @param {any} [data] - A value passed to the plugin's `init` method.
409+
*
410+
* @return {?Phaser.Plugins.BasePlugin} The plugin that was started, or `null` if `start` was false, or game isn't yet booted.
409411
*/
410412
install: function (key, plugin, start, mapping, data)
411413
{
@@ -416,13 +418,13 @@ var PluginManager = new Class({
416418
if (typeof plugin !== 'function')
417419
{
418420
console.warn('Invalid Plugin: ' + key);
419-
return;
421+
return null;
420422
}
421423

422424
if (PluginCache.hasCustom(key))
423425
{
424426
console.warn('Plugin key in use: ' + key);
425-
return;
427+
return null;
426428
}
427429

428430
if (mapping !== null)
@@ -444,6 +446,8 @@ var PluginManager = new Class({
444446
return this.start(key);
445447
}
446448
}
449+
450+
return null;
447451
},
448452

449453
/**

0 commit comments

Comments
 (0)