mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 13:13:43 +00:00
Merge pull request #3234 from nkholski/master
load.plugin now accepts class as an argument besides an url-string
This commit is contained in:
commit
de9cfb6ee2
2 changed files with 10 additions and 2 deletions
|
@ -65,7 +65,7 @@ var File = new Class({
|
|||
{
|
||||
this.url = GetFastValue(fileConfig, 'path', '') + this.key + '.' + GetFastValue(fileConfig, 'extension', '');
|
||||
}
|
||||
else
|
||||
else if (typeof(this.url) !== 'function')
|
||||
{
|
||||
this.url = GetFastValue(fileConfig, 'path', '').concat(this.url);
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ var File = new Class({
|
|||
* @type {integer}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.state = CONST.FILE_PENDING;
|
||||
this.state = typeof(this.url) === "function" ? CONST.FILE_POPULATED : CONST.FILE_PENDING;
|
||||
|
||||
/**
|
||||
* The total size of this file.
|
||||
|
|
|
@ -34,6 +34,14 @@ var PluginFile = new Class({
|
|||
|
||||
function PluginFile (key, url, path, xhrSettings)
|
||||
{
|
||||
// If the url variable refers to a class, add the plugin directly
|
||||
if (typeof url === 'function')
|
||||
{
|
||||
this.key = key;
|
||||
window[key] = url;
|
||||
window[key].register(PluginManager);
|
||||
}
|
||||
|
||||
var fileKey = (typeof key === 'string') ? key : GetFastValue(key, 'key', '');
|
||||
|
||||
var fileConfig = {
|
||||
|
|
Loading…
Reference in a new issue