diff --git a/src/loader/File.js b/src/loader/File.js index 8751ebcf2..a9a3bd9be 100644 --- a/src/loader/File.js +++ b/src/loader/File.js @@ -12,6 +12,12 @@ var MergeXHRSettings = require('./MergeXHRSettings'); var XHRLoader = require('./XHRLoader'); var XHRSettings = require('./XHRSettings'); +/** + * @callback FileProcessCallback + * + * @param {Phaser.Loader.File} file - [description] + */ + /** * @classdesc * [description] @@ -31,7 +37,7 @@ var File = new Class({ { /** * The file type string (image, json, etc) for sorting within the Loader. - * + * * @name Phaser.Loader.File#type * @type {string} * @since 3.0.0 @@ -219,7 +225,7 @@ var File = new Class({ * * @method Phaser.Loader.File#setLinkFile * @since 3.0.0 - * + * * @param {Phaser.Loader.File} fileB - The linked file. * @param {string} linkType - The type of association. */ @@ -350,7 +356,7 @@ var File = new Class({ * @method Phaser.Loader.File#onProcess * @since 3.0.0 * - * @param {function} callback - The callback to invoke to process this File. + * @param {FileProcessCallback} callback - The callback to invoke to process this File. */ onProcess: function (callback) { diff --git a/src/loader/filetypes/AudioFile.js b/src/loader/filetypes/AudioFile.js index 51ed9b832..7f60955f4 100644 --- a/src/loader/filetypes/AudioFile.js +++ b/src/loader/filetypes/AudioFile.js @@ -62,7 +62,7 @@ var AudioFile = new Class({ * @method Phaser.Loader.FileTypes.AudioFile#onProcess * @since 3.0.0 * - * @param {function} callback - [description] + * @param {FileProcessCallback} callback - [description] */ onProcess: function (callback) { diff --git a/src/physics/impact/components/Collides.js b/src/physics/impact/components/Collides.js index 0d5822cd4..85963fde4 100644 --- a/src/physics/impact/components/Collides.js +++ b/src/physics/impact/components/Collides.js @@ -6,6 +6,14 @@ var COLLIDES = require('../COLLIDES'); +/** + * @callback CollideCallback + * + * @param {Phaser.Physics.Impact.Body} body - [description] + * @param {Phaser.Physics.Impact.Body} other - [description] + * @param {string} axis - [description] + */ + /** * [description] * @@ -23,7 +31,7 @@ var Collides = { * @method Phaser.Physics.Impact.Components.Collides#setCollideCallback * @since 3.0.0 * - * @param {function} callback - [description] + * @param {CollideCallback} callback - [description] * @param {object} scope - [description] * * @return {Phaser.GameObjects.GameObject} This Game Object. diff --git a/src/sound/BaseSoundManager.js b/src/sound/BaseSoundManager.js index 6596668ad..2b50b3de4 100644 --- a/src/sound/BaseSoundManager.js +++ b/src/sound/BaseSoundManager.js @@ -7,6 +7,15 @@ var Class = require('../utils/Class'); var EventEmitter = require('eventemitter3'); var NOOP = require('../utils/NOOP'); +/** + * @callback EachActiveSoundCallback + * + * @param {Phaser.Sound.BaseSoundManager} manager - [description] + * @param {Phaser.Sound.BaseSound} sound - [description] + * @param {number} index - [description] + * @param {Phaser.Sound.BaseSound[]} sounds - [description] + */ + /** * @classdesc * The sound manager is responsible for playing back audio via Web Audio API or HTML Audio tag as fallback. @@ -466,17 +475,17 @@ var BaseSoundManager = new Class({ * @private * @since 3.0.0 * - * @param {function} callbackfn - Callback function. (sound: ISound, index: number, array: ISound[]) => void + * @param {EachActiveSoundCallback} callback - Callback function. (sound: ISound, index: number, array: ISound[]) => void * @param {object} [scope] - Callback context. */ - forEachActiveSound: function (callbackfn, scope) + forEachActiveSound: function (callback, scope) { var _this = this; this.sounds.forEach(function (sound, index) { if (!sound.pendingRemove) { - callbackfn.call(scope || _this, sound, index, _this.sounds); + callback.call(scope || _this, sound, index, _this.sounds); } }); }, diff --git a/src/structs/List.js b/src/structs/List.js index ef8e445f8..826dbefee 100644 --- a/src/structs/List.js +++ b/src/structs/List.js @@ -6,6 +6,13 @@ var Class = require('../utils/Class'); +/** + * @callback EachListCallback + * + * @param {any} item - [description] + * @param {...*} [arguments] - Additional arguments that will be passed to the callback, after the child. + */ + /** * @classdesc * [description] @@ -737,7 +744,7 @@ var List = new Class({ * @method Phaser.Structs.List#each * @since 3.0.0 * - * @param {function} callback - The function to call. + * @param {EachListCallback} callback - The function to call. * @param {object} [thisArg] - Value to use as `this` when executing callback. * @param {...*} [arguments] - Additional arguments that will be passed to the callback, after the child. */ diff --git a/src/structs/Map.js b/src/structs/Map.js index b531ce8fd..21168a853 100644 --- a/src/structs/Map.js +++ b/src/structs/Map.js @@ -6,6 +6,15 @@ var Class = require('../utils/Class'); +/** + * @callback EachMapCallback + * + * @param {string} key - [description] + * @param {any} entry - [description] + * + * @return {?boolean} [description] + */ + /** * @classdesc * The keys of a Map can be arbitrary values. @@ -32,7 +41,7 @@ var Map = new Class({ * [description] * * @name Phaser.Structs.Map#entries - * @type {object} + * @type {Object.} * @default {} * @since 3.0.0 */ @@ -237,7 +246,7 @@ var Map = new Class({ * @method Phaser.Structs.Map#each * @since 3.0.0 * - * @param {function} callback - [description] + * @param {EachMapCallback} callback - [description] * * @return {Phaser.Structs.Map} This Map object. */ diff --git a/src/structs/Set.js b/src/structs/Set.js index 1f98668b3..687fd7a74 100644 --- a/src/structs/Set.js +++ b/src/structs/Set.js @@ -6,6 +6,15 @@ var Class = require('../utils/Class'); +/** + * @callback EachSetCallback + * + * @param {any} entry - [description] + * @param {number} index - [description] + * + * @return {?boolean} [description] + */ + /** * @classdesc * A Set is a collection of unique elements. @@ -148,7 +157,7 @@ var Set = new Class({ * @method Phaser.Structs.Set#each * @since 3.0.0 * - * @param {function} callback - [description] + * @param {EachSetCallback} callback - [description] * @param {object} callbackScope - [description] * * @return {Phaser.Structs.Set} This Set object. @@ -189,7 +198,7 @@ var Set = new Class({ * @method Phaser.Structs.Set#iterate * @since 3.0.0 * - * @param {function} callback - [description] + * @param {EachSetCallback} callback - [description] * @param {object} callbackScope - [description] * * @return {Phaser.Structs.Set} This Set object. diff --git a/src/textures/TextureManager.js b/src/textures/TextureManager.js index 79f53a4d1..68df61d63 100644 --- a/src/textures/TextureManager.js +++ b/src/textures/TextureManager.js @@ -13,6 +13,13 @@ var GetValue = require('../utils/object/GetValue'); var Parser = require('./parsers'); var Texture = require('./Texture'); +/** + * @callback EachTextureCallback + * + * @param {Phaser.Textures.Texture} texture - [description] + * @param {...*} [arguments] - Additional arguments that will be passed to the callback, after the child. + */ + /** * @classdesc * Textures are managed by the global TextureManager. This is a singleton class that is @@ -163,7 +170,7 @@ var TextureManager = new Class({ image.onload = function () { var texture = _this.create(key, image); - + Parser.Image(texture, 0); _this.emit('onload', key, texture); @@ -187,7 +194,7 @@ var TextureManager = new Class({ addImage: function (key, source, dataSource) { var texture = this.create(key, source); - + Parser.Image(texture, 0); if (dataSource) @@ -262,7 +269,7 @@ var TextureManager = new Class({ addCanvas: function (key, source) { var texture = this.create(key, source); - + Parser.Canvas(texture, 0); return texture; @@ -386,7 +393,7 @@ var TextureManager = new Class({ /** * Adds a Sprite Sheet to this Texture Manager. - * + * * In Phaser terminology a Sprite Sheet is a texture containing different frames, but each frame is the exact * same size and cannot be trimmed or rotated. * @@ -419,7 +426,7 @@ var TextureManager = new Class({ /** * Adds a Sprite Sheet to this Texture Manager, where the Sprite Sheet exists as a Frame within a Texture Atlas. - * + * * In Phaser terminology a Sprite Sheet is a texture containing different frames, but each frame is the exact * same size and cannot be trimmed or rotated. * @@ -738,7 +745,7 @@ var TextureManager = new Class({ * @method Phaser.Textures.TextureManager#each * @since 3.0.0 * - * @param {function} callback - The callback function to be sent the Textures. + * @param {EachTextureCallback} callback - The callback function to be sent the Textures. * @param {object} scope - The value to use as `this` when executing the callback. * @param {...*} [arguments] - Additional arguments that will be passed to the callback, after the child. */