Add more callbacks

This commit is contained in:
orblazer 2018-03-19 22:57:46 +01:00
parent 1e8311e1ab
commit fa13b597e3
8 changed files with 74 additions and 19 deletions

View file

@ -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]
@ -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)
{

View file

@ -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)
{

View file

@ -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.

View file

@ -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);
}
});
},

View file

@ -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.
*/

View file

@ -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.<string, any>}
* @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.
*/

View file

@ -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.

View file

@ -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
@ -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.
*/