From 13f5608cbe92bc6c9ad2f27bdf4933669188aa05 Mon Sep 17 00:00:00 2001 From: Richard Davey Date: Wed, 21 Mar 2018 14:41:04 +0000 Subject: [PATCH] Added XHRSettings Conf --- src/loader/File.js | 10 +++++----- src/loader/LoaderPlugin.js | 2 +- src/loader/MergeXHRSettings.js | 6 +++--- src/loader/XHRLoader.js | 2 +- src/loader/XHRSettings.js | 18 ++++++++++++++---- src/loader/filetypes/AnimationJSONFile.js | 4 ++-- src/loader/filetypes/AtlasJSONFile.js | 4 ++-- src/loader/filetypes/AudioFile.js | 2 +- src/loader/filetypes/AudioSprite.js | 4 ++-- src/loader/filetypes/BinaryFile.js | 2 +- src/loader/filetypes/BitmapFontFile.js | 4 ++-- src/loader/filetypes/GLSLFile.js | 2 +- src/loader/filetypes/HTML5AudioFile.js | 2 +- src/loader/filetypes/HTMLFile.js | 2 +- src/loader/filetypes/ImageFile.js | 2 +- src/loader/filetypes/JSONFile.js | 2 +- src/loader/filetypes/MultiAtlas.js | 4 ++-- src/loader/filetypes/PluginFile.js | 2 +- src/loader/filetypes/SVGFile.js | 2 +- src/loader/filetypes/ScriptFile.js | 2 +- src/loader/filetypes/SpriteSheetFile.js | 2 +- src/loader/filetypes/TextFile.js | 2 +- src/loader/filetypes/TilemapCSVFile.js | 2 +- src/loader/filetypes/TilemapJSONFile.js | 2 +- src/loader/filetypes/UnityAtlasFile.js | 4 ++-- src/loader/filetypes/XMLFile.js | 2 +- 26 files changed, 51 insertions(+), 41 deletions(-) diff --git a/src/loader/File.js b/src/loader/File.js index 7ec0e2d14..e62149171 100644 --- a/src/loader/File.js +++ b/src/loader/File.js @@ -89,7 +89,7 @@ var File = new Class({ * The merged XHRSettings for this file. * * @name Phaser.Loader.File#xhrSettings - * @type {Phaser.Loader.XHRSettings} + * @type {Phaser.Loader.XHRSettingsConfig} * @since 3.0.0 */ this.xhrSettings = XHRSettings(GetFastValue(fileConfig, 'responseType', undefined)); @@ -109,10 +109,10 @@ var File = new Class({ this.loader = null; /** - * The XHR Loader instance that is loading this File. + * The XHR Loader function that is loading this File. * * @name Phaser.Loader.File#xhrLoader - * @type {?Phaser.Loader.XHRLoader} + * @type {?function} * @since 3.0.0 */ this.xhrLoader = null; @@ -404,7 +404,7 @@ var File = new Class({ * * @method Phaser.Loader.File.createObjectURL * @static - * @param {Image} image - Image object which 'src' attribute should be set to object URL. + * @param {HTMLImageElement} image - Image object which 'src' attribute should be set to object URL. * @param {Blob} blob - A Blob object to create an object URL for. * @param {string} defaultType - Default mime type used if blob type is not available. */ @@ -436,7 +436,7 @@ File.createObjectURL = function (image, blob, defaultType) * * @method Phaser.Loader.File.revokeObjectURL * @static - * @param {Image} image - Image object which 'src' attribute should be revoked. + * @param {HTMLImageElement} image - Image object which 'src' attribute should be revoked. */ File.revokeObjectURL = function (image) { diff --git a/src/loader/LoaderPlugin.js b/src/loader/LoaderPlugin.js index af07d59ba..b8a3801ae 100644 --- a/src/loader/LoaderPlugin.js +++ b/src/loader/LoaderPlugin.js @@ -122,7 +122,7 @@ var LoaderPlugin = new Class({ * xhr specific global settings (can be overridden on a per-file basis) * * @name Phaser.Loader.LoaderPlugin#xhr - * @type {Phaser.Loader.XHRSettings} + * @type {Phaser.Loader.XHRSettingsConfig} * @since 3.0.0 */ this.xhr = XHRSettings( diff --git a/src/loader/MergeXHRSettings.js b/src/loader/MergeXHRSettings.js index a2c4ee1fa..e5a407032 100644 --- a/src/loader/MergeXHRSettings.js +++ b/src/loader/MergeXHRSettings.js @@ -16,10 +16,10 @@ var XHRSettings = require('./XHRSettings'); * @function Phaser.Loader.MergeXHRSettings * @since 3.0.0 * - * @param {Phaser.Loader.XHRSettings} global - The global XHRSettings object. - * @param {Phaser.Loader.XHRSettings} local - The local XHRSettings object. + * @param {Phaser.Loader.XHRSettingsConfig} global - The global XHRSettings object. + * @param {Phaser.Loader.XHRSettingsConfig} local - The local XHRSettings object. * - * @return {Phaser.Loader.XHRSettings} A newly formed XHRSettings object. + * @return {Phaser.Loader.XHRSettingsConfig} A newly formed XHRSettings object. */ var MergeXHRSettings = function (global, local) { diff --git a/src/loader/XHRLoader.js b/src/loader/XHRLoader.js index f61d15b94..dd66dffd7 100644 --- a/src/loader/XHRLoader.js +++ b/src/loader/XHRLoader.js @@ -15,7 +15,7 @@ var MergeXHRSettings = require('./MergeXHRSettings'); * @since 3.0.0 * * @param {Phaser.Loader.File} file - The File to download. - * @param {Phaser.Loader.XHRSettings} globalXHRSettings - The global XHRSettings object. + * @param {Phaser.Loader.XHRSettingsConfig} globalXHRSettings - The global XHRSettings object. * * @return {XMLHttpRequest} The XHR object. */ diff --git a/src/loader/XHRSettings.js b/src/loader/XHRSettings.js index 8041702d0..b055ee179 100644 --- a/src/loader/XHRSettings.js +++ b/src/loader/XHRSettings.js @@ -4,19 +4,29 @@ * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ +/** + * @typedef {object} Phaser.Loader.XHRSettingsConfig + * + * @property {string} [responseType=''] - [description] + * @property {boolean} [async=true] - [description] + * @property {string} [user=''] - [description] + * @property {string} [password=''] - [description] + * @property {integer} [timeout=0] - [description] + */ + /** * Creates an XHRSettings Object with default values. * * @function Phaser.Loader.XHRSettings * @since 3.0.0 * - * @param {string} [responseType] - The responseType, such as 'text'. + * @param {string} [responseType=''] - The responseType, such as 'text'. * @param {boolean} [async=true] - Should the XHR request use async or not? - * @param {string} [user] - Optional username for the XHR request. - * @param {string} [password] - Optional password for the XHR request. + * @param {string} [user=''] - Optional username for the XHR request. + * @param {string} [password=''] - Optional password for the XHR request. * @param {integer} [timeout=0] - Optional XHR timeout value. * - * @return {Phaser.Loader.XHRSettings} The XHRSettings object as used by the Loader. + * @return {Phaser.Loader.XHRSettingsConfig} The XHRSettings object as used by the Loader. */ var XHRSettings = function (responseType, async, user, password, timeout) { diff --git a/src/loader/filetypes/AnimationJSONFile.js b/src/loader/filetypes/AnimationJSONFile.js index e114060b6..3423e19f2 100644 --- a/src/loader/filetypes/AnimationJSONFile.js +++ b/src/loader/filetypes/AnimationJSONFile.js @@ -16,9 +16,9 @@ var JSONFile = require('./JSONFile.js'); * @param {string} key - The key of the file within the loader. * @param {string} url - The url to load the file from. * @param {string} path - The path of the file. - * @param {object} xhrSettings - Optional file specific XHR settings. + * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - Optional file specific XHR settings. * - * @return {Phaser.Loader.FileTypes.AnimationJSONFile} A File instance to be added to the Loader. + * @return {Phaser.Loader.FileTypes.JSONFile} A File instance to be added to the Loader. */ var AnimationJSONFile = function (key, url, path, xhrSettings) { diff --git a/src/loader/filetypes/AtlasJSONFile.js b/src/loader/filetypes/AtlasJSONFile.js index 739670daf..c18f870f4 100644 --- a/src/loader/filetypes/AtlasJSONFile.js +++ b/src/loader/filetypes/AtlasJSONFile.js @@ -18,8 +18,8 @@ var JSONFile = require('./JSONFile.js'); * @param {string} textureURL - The url to load the texture file from. * @param {string} atlasURL - The url to load the atlas file from. * @param {string} path - The path of the file. - * @param {object} textureXhrSettings - Optional texture file specific XHR settings. - * @param {object} atlasXhrSettings - Optional atlas file specific XHR settings. + * @param {Phaser.Loader.XHRSettingsConfig} textureXhrSettings - Optional texture file specific XHR settings. + * @param {Phaser.Loader.XHRSettingsConfig} atlasXhrSettings - Optional atlas file specific XHR settings. * * @return {object} An object containing two File objects to be added to the loader. */ diff --git a/src/loader/filetypes/AudioFile.js b/src/loader/filetypes/AudioFile.js index 042a62be9..b8adda949 100644 --- a/src/loader/filetypes/AudioFile.js +++ b/src/loader/filetypes/AudioFile.js @@ -24,7 +24,7 @@ var HTML5AudioFile = require('./HTML5AudioFile'); * @param {string} key - [description] * @param {string} url - [description] * @param {string} path - [description] - * @param {object} xhrSettings - [description] + * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - [description] * @param {AudioContext} audioContext - [description] */ var AudioFile = new Class({ diff --git a/src/loader/filetypes/AudioSprite.js b/src/loader/filetypes/AudioSprite.js index 2db0821b5..b5b55ce7a 100644 --- a/src/loader/filetypes/AudioSprite.js +++ b/src/loader/filetypes/AudioSprite.js @@ -24,8 +24,8 @@ var JSONFile = require('./JSONFile.js'); * @param {(string|string[])} urls - [description] * @param {object} json - [description] * @param {object} config - [description] - * @param {object} audioXhrSettings - Optional file specific XHR settings. - * @param {object} jsonXhrSettings - Optional file specific XHR settings. + * @param {Phaser.Loader.XHRSettingsConfig} audioXhrSettings - Optional file specific XHR settings. + * @param {Phaser.Loader.XHRSettingsConfig} jsonXhrSettings - Optional file specific XHR settings. * * @return {Phaser.Loader.LoaderPlugin} The Loader. */ diff --git a/src/loader/filetypes/BinaryFile.js b/src/loader/filetypes/BinaryFile.js index 854d79495..20ee12129 100644 --- a/src/loader/filetypes/BinaryFile.js +++ b/src/loader/filetypes/BinaryFile.js @@ -23,7 +23,7 @@ var GetFastValue = require('../../utils/object/GetFastValue'); * @param {string} key - [description] * @param {string} url - [description] * @param {string} path - [description] - * @param {object} xhrSettings - [description] + * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - [description] */ var BinaryFile = new Class({ diff --git a/src/loader/filetypes/BitmapFontFile.js b/src/loader/filetypes/BitmapFontFile.js index e255a1759..9449f2d8e 100644 --- a/src/loader/filetypes/BitmapFontFile.js +++ b/src/loader/filetypes/BitmapFontFile.js @@ -18,8 +18,8 @@ var XMLFile = require('./XMLFile.js'); * @param {string} textureURL - The url to load the texture file from. * @param {string} xmlURL - The url to load the atlas file from. * @param {string} path - The path of the file. - * @param {object} textureXhrSettings - Optional texture file specific XHR settings. - * @param {object} xmlXhrSettings - Optional atlas file specific XHR settings. + * @param {Phaser.Loader.XHRSettingsConfig} textureXhrSettings - Optional texture file specific XHR settings. + * @param {Phaser.Loader.XHRSettingsConfig} xmlXhrSettings - Optional atlas file specific XHR settings. * * @return {object} An object containing two File objects to be added to the loader. */ diff --git a/src/loader/filetypes/GLSLFile.js b/src/loader/filetypes/GLSLFile.js index ade172941..1914b54ed 100644 --- a/src/loader/filetypes/GLSLFile.js +++ b/src/loader/filetypes/GLSLFile.js @@ -23,7 +23,7 @@ var GetFastValue = require('../../utils/object/GetFastValue'); * @param {string} key - [description] * @param {string} url - [description] * @param {string} path - [description] - * @param {object} xhrSettings - [description] + * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - [description] */ var GLSLFile = new Class({ diff --git a/src/loader/filetypes/HTML5AudioFile.js b/src/loader/filetypes/HTML5AudioFile.js index 356ffb598..a50405de7 100644 --- a/src/loader/filetypes/HTML5AudioFile.js +++ b/src/loader/filetypes/HTML5AudioFile.js @@ -22,7 +22,7 @@ var GetURL = require('../GetURL'); * @param {string} key - [description] * @param {string} url - [description] * @param {string} path - [description] - * @param {object} config - [description] + * @param {Phaser.Loader.XHRSettingsConfig} config - [description] * @param {boolean} locked - [description] */ var HTML5AudioFile = new Class({ diff --git a/src/loader/filetypes/HTMLFile.js b/src/loader/filetypes/HTMLFile.js index 8c03d7350..8043297a0 100644 --- a/src/loader/filetypes/HTMLFile.js +++ b/src/loader/filetypes/HTMLFile.js @@ -25,7 +25,7 @@ var GetFastValue = require('../../utils/object/GetFastValue'); * @param {number} width - [description] * @param {number} height - [description] * @param {string} path - [description] - * @param {object} xhrSettings - [description] + * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - [description] */ var HTMLFile = new Class({ diff --git a/src/loader/filetypes/ImageFile.js b/src/loader/filetypes/ImageFile.js index 33b458d0a..d52623cc5 100644 --- a/src/loader/filetypes/ImageFile.js +++ b/src/loader/filetypes/ImageFile.js @@ -23,7 +23,7 @@ var GetFastValue = require('../../utils/object/GetFastValue'); * @param {string} key - [description] * @param {string} url - [description] * @param {string} path - [description] - * @param {object} xhrSettings - [description] + * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - [description] * @param {object} config - [description] */ var ImageFile = new Class({ diff --git a/src/loader/filetypes/JSONFile.js b/src/loader/filetypes/JSONFile.js index 316f0ef3a..88d05e142 100644 --- a/src/loader/filetypes/JSONFile.js +++ b/src/loader/filetypes/JSONFile.js @@ -23,7 +23,7 @@ var GetFastValue = require('../../utils/object/GetFastValue'); * @param {string} key - [description] * @param {string} url - [description] * @param {string} path - [description] - * @param {object} xhrSettings - [description] + * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - [description] */ var JSONFile = new Class({ diff --git a/src/loader/filetypes/MultiAtlas.js b/src/loader/filetypes/MultiAtlas.js index 274908be6..ead50b96d 100644 --- a/src/loader/filetypes/MultiAtlas.js +++ b/src/loader/filetypes/MultiAtlas.js @@ -23,8 +23,8 @@ var NumberArray = require('../../utils/array/NumberArray'); * @param {string} key - [description] * @param {string[]} textureURLs - [description] * @param {string[]} atlasURLs - [description] - * @param {object} textureXhrSettings - [description] - * @param {object} atlasXhrSettings - [description] + * @param {Phaser.Loader.XHRSettingsConfig} textureXhrSettings - [description] + * @param {Phaser.Loader.XHRSettingsConfig} atlasXhrSettings - [description] * * @return {Phaser.Loader.LoaderPlugin} The Loader. */ diff --git a/src/loader/filetypes/PluginFile.js b/src/loader/filetypes/PluginFile.js index 81ab63fb1..816dfbac1 100644 --- a/src/loader/filetypes/PluginFile.js +++ b/src/loader/filetypes/PluginFile.js @@ -24,7 +24,7 @@ var PluginManager = require('../../boot/PluginManager'); * @param {string} key - [description] * @param {string} url - [description] * @param {string} path - [description] - * @param {object} xhrSettings - [description] + * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - [description] */ var PluginFile = new Class({ diff --git a/src/loader/filetypes/SVGFile.js b/src/loader/filetypes/SVGFile.js index a24f26ac9..1e775e196 100644 --- a/src/loader/filetypes/SVGFile.js +++ b/src/loader/filetypes/SVGFile.js @@ -23,7 +23,7 @@ var GetFastValue = require('../../utils/object/GetFastValue'); * @param {string} key - [description] * @param {string} url - [description] * @param {string} path - [description] - * @param {object} xhrSettings - [description] + * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - [description] */ var SVGFile = new Class({ diff --git a/src/loader/filetypes/ScriptFile.js b/src/loader/filetypes/ScriptFile.js index 9f3e864c6..86aed836d 100644 --- a/src/loader/filetypes/ScriptFile.js +++ b/src/loader/filetypes/ScriptFile.js @@ -23,7 +23,7 @@ var GetFastValue = require('../../utils/object/GetFastValue'); * @param {string} key - [description] * @param {string} url - [description] * @param {string} path - [description] - * @param {object} xhrSettings - [description] + * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - [description] */ var ScriptFile = new Class({ diff --git a/src/loader/filetypes/SpriteSheetFile.js b/src/loader/filetypes/SpriteSheetFile.js index c1f2ae637..e689d1cb5 100644 --- a/src/loader/filetypes/SpriteSheetFile.js +++ b/src/loader/filetypes/SpriteSheetFile.js @@ -17,7 +17,7 @@ var ImageFile = require('./ImageFile.js'); * @param {string} url - The url to load the texture file from. * @param {object} config - Optional texture file specific XHR settings. * @param {string} path - Optional texture file specific XHR settings. - * @param {object} xhrSettings - Optional atlas file specific XHR settings. + * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - Optional atlas file specific XHR settings. * * @return {object} An object containing two File objects to be added to the loader. */ diff --git a/src/loader/filetypes/TextFile.js b/src/loader/filetypes/TextFile.js index 9f67861da..c420120db 100644 --- a/src/loader/filetypes/TextFile.js +++ b/src/loader/filetypes/TextFile.js @@ -22,7 +22,7 @@ var FileTypesManager = require('../FileTypesManager'); * @param {string} key - [description] * @param {string} url - [description] * @param {string} path - [description] - * @param {object} xhrSettings - [description] + * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - [description] */ var TextFile = new Class({ diff --git a/src/loader/filetypes/TilemapCSVFile.js b/src/loader/filetypes/TilemapCSVFile.js index 96c85362b..a71fccb94 100644 --- a/src/loader/filetypes/TilemapCSVFile.js +++ b/src/loader/filetypes/TilemapCSVFile.js @@ -24,7 +24,7 @@ var TILEMAP_FORMATS = require('../../tilemaps/Formats'); * @param {string} url - [description] * @param {string} path - [description] * @param {string} format - [description] - * @param {object} xhrSettings - [description] + * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - [description] */ var TilemapCSVFile = new Class({ diff --git a/src/loader/filetypes/TilemapJSONFile.js b/src/loader/filetypes/TilemapJSONFile.js index 21613e7be..e5d04c5e7 100644 --- a/src/loader/filetypes/TilemapJSONFile.js +++ b/src/loader/filetypes/TilemapJSONFile.js @@ -18,7 +18,7 @@ var TILEMAP_FORMATS = require('../../tilemaps/Formats'); * @param {string} url - [description] * @param {string} path - [description] * @param {string} format - [description] - * @param {object} xhrSettings - [description] + * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - [description] * * @return {object} An object containing two File objects to be added to the loader. */ diff --git a/src/loader/filetypes/UnityAtlasFile.js b/src/loader/filetypes/UnityAtlasFile.js index f99eca897..f68b0c088 100644 --- a/src/loader/filetypes/UnityAtlasFile.js +++ b/src/loader/filetypes/UnityAtlasFile.js @@ -18,8 +18,8 @@ var TextFile = require('./TextFile.js'); * @param {string} textureURL - The url to load the texture file from. * @param {string} atlasURL - The url to load the atlas file from. * @param {string} path - The path of the file. - * @param {object} textureXhrSettings - Optional texture file specific XHR settings. - * @param {object} atlasXhrSettings - Optional atlas file specific XHR settings. + * @param {Phaser.Loader.XHRSettingsConfig} textureXhrSettings - Optional texture file specific XHR settings. + * @param {Phaser.Loader.XHRSettingsConfig} atlasXhrSettings - Optional atlas file specific XHR settings. * * @return {object} An object containing two File objects to be added to the loader. */ diff --git a/src/loader/filetypes/XMLFile.js b/src/loader/filetypes/XMLFile.js index 9a0ab22f4..f8b82e82f 100644 --- a/src/loader/filetypes/XMLFile.js +++ b/src/loader/filetypes/XMLFile.js @@ -24,7 +24,7 @@ var ParseXML = require('../../dom/ParseXML'); * @param {string} key - [description] * @param {string} url - [description] * @param {string} path - [description] - * @param {object} xhrSettings - [description] + * @param {Phaser.Loader.XHRSettingsConfig} xhrSettings - [description] */ var XMLFile = new Class({