Merge pull request #3425 from orblazer/fix-types

Add callbacks types
This commit is contained in:
Richard Davey 2018-03-19 23:02:37 +00:00 committed by GitHub
commit f4f88a6daa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 395 additions and 149 deletions

View file

@ -4,14 +4,20 @@
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/ */
/**
* @callback CallCallback
*
* @param {Phaser.GameObjects.GameObject} item - [description]
*/
/** /**
* Takes an array of objects and passes each of them to the given callback. * Takes an array of objects and passes each of them to the given callback.
* *
* @function Phaser.Actions.Call * @function Phaser.Actions.Call
* @since 3.0.0 * @since 3.0.0
* *
* @param {array|Phaser.GameObjects.GameObject[]} items - The array of items to be updated by this action. * @param {array|Phaser.GameObjects.GameObject[]} items - The array of items to be updated by this action.
* @param {function} callback - The callback to be invoked. It will be passed just one argument: the item from the array. * @param {CallCallback} callback - The callback to be invoked. It will be passed just one argument: the item from the array.
* @param {object} context - The scope in which the callback will be invoked. * @param {object} context - The scope in which the callback will be invoked.
* *
* @return {array} The array of objects that was passed to this Action. * @return {array} The array of objects that was passed to this Action.

View file

@ -9,10 +9,10 @@
* *
* @function Phaser.Actions.SetHitArea * @function Phaser.Actions.SetHitArea
* @since 3.0.0 * @since 3.0.0
* *
* @param {array} items - An array of Game Objects. The contents of this array are updated by this Action. * @param {array} items - An array of Game Objects. The contents of this array are updated by this Action.
* @param {any} hitArea - [description] * @param {any} hitArea - [description]
* @param {function} hitAreaCallback - [description] * @param {HitAreaCallback} hitAreaCallback - [description]
* *
* @return {array} The array of Game Objects that was passed to this Action. * @return {array} The array of Game Objects that was passed to this Action.
*/ */

View file

@ -18,6 +18,12 @@ var ValueToColor = require('../display/color/ValueToColor');
* @callback NOOP * @callback NOOP
*/ */
/**
* @callback BootCallback
*
* @param {Phaser.Game} game - [description]
*/
/** /**
* @typedef {object} FPSConfig * @typedef {object} FPSConfig
* *
@ -86,8 +92,8 @@ var ValueToColor = require('../display/color/ValueToColor');
* @property {boolean} [powerPreference='default'] - "high-performance", "low-power" or "default" * @property {boolean} [powerPreference='default'] - "high-performance", "low-power" or "default"
* @property {string|number} [backgroundColor=0x000000] - [description] * @property {string|number} [backgroundColor=0x000000] - [description]
* @property {object} [?callbacks] - [description] * @property {object} [?callbacks] - [description]
* @property {function} [callbacks.preBoot=NOOP] - [description] * @property {BootCallback} [callbacks.preBoot=NOOP] - [description]
* @property {function} [callbacks.postBoot=NOOP] - [description] * @property {BootCallback} [callbacks.postBoot=NOOP] - [description]
* @property {LoaderConfig} [?loader] - [description] * @property {LoaderConfig} [?loader] - [description]
* @property {object} [?images] - [description] * @property {object} [?images] - [description]
* @property {string} [images.default] - [description] * @property {string} [images.default] - [description]

View file

@ -25,6 +25,10 @@ var TextureManager = require('../textures/TextureManager');
var TimeStep = require('./TimeStep'); var TimeStep = require('./TimeStep');
var VisibilityHandler = require('./VisibilityHandler'); var VisibilityHandler = require('./VisibilityHandler');
/**
* @callback GameStepCallback
*/
/** /**
* @classdesc * @classdesc
* The Phaser.Game instance is the main controller for the entire Phaser game. It is responsible * The Phaser.Game instance is the main controller for the entire Phaser game. It is responsible
@ -232,7 +236,7 @@ var Game = new Class({
* It is set automatically when the Game boot process has completed. * It is set automatically when the Game boot process has completed.
* *
* @name Phaser.Game#onStepCallback * @name Phaser.Game#onStepCallback
* @type {function} * @type {GameStepCallback}
* @private * @private
* @since 3.0.0 * @since 3.0.0
*/ */

View file

@ -20,6 +20,14 @@ var RequestAnimationFrame = require('../dom/RequestAnimationFrame');
// http://www.testufo.com/#test=animation-time-graph // http://www.testufo.com/#test=animation-time-graph
/**
* @callback TimeStepCallback
*
* @param {number} time - The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout.
* @param {number} average - The Delta Average.
* @param {number} interpolation - Interpolation - how far between what is expected and where we are?
*/
/** /**
* @classdesc * @classdesc
* [description] * [description]
@ -78,7 +86,7 @@ var TimeStep = new Class({
* @since 3.0.0 * @since 3.0.0
*/ */
this.running = false; this.running = false;
/** /**
* The minimum fps rate you want the Time Step to run at. * The minimum fps rate you want the Time Step to run at.
* *
@ -90,7 +98,7 @@ var TimeStep = new Class({
/** /**
* The target fps rate for the Time Step to run at. * The target fps rate for the Time Step to run at.
* *
* Setting this value will not actually change the speed at which the browser runs, that is beyond * Setting this value will not actually change the speed at which the browser runs, that is beyond
* the control of Phaser. Instead, it allows you to determine performance issues and if the Time Step * the control of Phaser. Instead, it allows you to determine performance issues and if the Time Step
* is spiraling out of control. * is spiraling out of control.
@ -154,7 +162,7 @@ var TimeStep = new Class({
/** /**
* A callback to be invoked each time the Time Step steps. * A callback to be invoked each time the Time Step steps.
* *
* @property {function} callback * @property {TimeStepCallback} callback
* @default NOOP * @default NOOP
* @since 3.0.0 * @since 3.0.0
*/ */
@ -379,7 +387,7 @@ var TimeStep = new Class({
* @method Phaser.Boot.TimeStep#start * @method Phaser.Boot.TimeStep#start
* @since 3.0.0 * @since 3.0.0
* *
* @param {function} callback - The callback to be invoked each time the Time Step steps. * @param {TimeStepCallback} callback - The callback to be invoked each time the Time Step steps.
*/ */
start: function (callback) start: function (callback)
{ {
@ -544,7 +552,7 @@ var TimeStep = new Class({
if (this.running) if (this.running)
{ {
this.raf.stop(); this.raf.stop();
this.running = false; this.running = false;
} }
}, },

View file

@ -8,6 +8,13 @@ var Arne16 = require('./palettes/Arne16');
var CanvasPool = require('../display/canvas/CanvasPool'); var CanvasPool = require('../display/canvas/CanvasPool');
var GetValue = require('../utils/object/GetValue'); var GetValue = require('../utils/object/GetValue');
/**
* @callback GenerateTextureRendererCallback
*
* @param {HTMLCanvasElement} canvas - [description]
* @param {CanvasRenderingContext2D} context - [description]
*/
/** /**
* @typedef {object} GenerateTextureConfig * @typedef {object} GenerateTextureConfig
* *
@ -18,8 +25,8 @@ var GetValue = require('../utils/object/GetValue');
* @property {number} [pixelHeight=1] - [description] * @property {number} [pixelHeight=1] - [description]
* @property {boolean} [resizeCanvas=true] - [description] * @property {boolean} [resizeCanvas=true] - [description]
* @property {boolean} [clearCanvas=true] - [description] * @property {boolean} [clearCanvas=true] - [description]
* @property {function} [preRender] - [description] * @property {GenerateTextureRendererCallback} [preRender] - [description]
* @property {function} [postRender] - [description] * @property {GenerateTextureRendererCallback} [postRender] - [description]
*/ */
/** /**

View file

@ -6,6 +6,15 @@
var Class = require('../utils/Class'); var Class = require('../utils/Class');
/**
* @callback DataEachCallback
*
* @param {any} parent - [description]
* @param {string} key - [description]
* @param {any} value - [description]
* @param {...*} [arguments] - Additional arguments that will be passed to the callback, after the game object, key, and data.
*/
/** /**
* @classdesc * @classdesc
* The Data Component features a means to store pieces of data specific to a Game Object, System or Plugin. * The Data Component features a means to store pieces of data specific to a Game Object, System or Plugin.
@ -199,7 +208,7 @@ var DataManager = new Class({
* @method Phaser.Data.DataManager#each * @method Phaser.Data.DataManager#each
* @since 3.0.0 * @since 3.0.0
* *
* @param {function} callback - The function to call. * @param {DataEachCallback} callback - The function to call.
* @param {object} [scope] - Value to use as `this` when executing callback. * @param {object} [scope] - Value to use as `this` when executing callback.
* @param {...*} [arguments] - Additional arguments that will be passed to the callback, after the game object, key, and data. * @param {...*} [arguments] - Additional arguments that will be passed to the callback, after the game object, key, and data.
* *

View file

@ -6,6 +6,10 @@
var OS = require('../device/OS'); var OS = require('../device/OS');
/**
* @callback ContentLoadedCallback
*/
/** /**
* Inspects the readyState of the document. If the document is already complete then it invokes the given callback. * Inspects the readyState of the document. If the document is already complete then it invokes the given callback.
* If not complete it sets up several event listeners such as `deviceready`, and once those fire, it invokes the callback. * If not complete it sets up several event listeners such as `deviceready`, and once those fire, it invokes the callback.
@ -14,7 +18,7 @@ var OS = require('../device/OS');
* @function Phaser.DOM.DOMContentLoaded * @function Phaser.DOM.DOMContentLoaded
* @since 3.0.0 * @since 3.0.0
* *
* @param {function} callback - The callback to be invoked when the device is ready and the DOM content is loaded. * @param {ContentLoadedCallback} callback - The callback to be invoked when the device is ready and the DOM content is loaded.
*/ */
var DOMContentLoaded = function (callback) var DOMContentLoaded = function (callback)
{ {

View file

@ -37,7 +37,7 @@ var RequestAnimationFrame = new Class({
* The callback to be invoked each step. * The callback to be invoked each step.
* *
* @name Phaser.DOM.RequestAnimationFrame#callback * @name Phaser.DOM.RequestAnimationFrame#callback
* @type {function} * @type {FrameRequestCallback}
* @since 3.0.0 * @since 3.0.0
*/ */
this.callback = NOOP; this.callback = NOOP;
@ -89,7 +89,7 @@ var RequestAnimationFrame = new Class({
* Updates the local tick value, invokes the callback and schedules another call to requestAnimationFrame. * Updates the local tick value, invokes the callback and schedules another call to requestAnimationFrame.
* *
* @name Phaser.DOM.RequestAnimationFrame#step * @name Phaser.DOM.RequestAnimationFrame#step
* @type {function} * @type {FrameRequestCallback}
* @since 3.0.0 * @since 3.0.0
*/ */
this.step = function step (timestamp) this.step = function step (timestamp)
@ -134,7 +134,7 @@ var RequestAnimationFrame = new Class({
* @method Phaser.DOM.RequestAnimationFrame#start * @method Phaser.DOM.RequestAnimationFrame#start
* @since 3.0.0 * @since 3.0.0
* *
* @param {function} callback - The callback to invoke each step. * @param {FrameRequestCallback} callback - The callback to invoke each step.
* @param {boolean} forceSetTimeOut - Should it use SetTimeout, even if RAF is available? * @param {boolean} forceSetTimeOut - Should it use SetTimeout, even if RAF is available?
*/ */
start: function (callback, forceSetTimeOut) start: function (callback, forceSetTimeOut)

View file

@ -254,7 +254,7 @@ var GameObject = new Class({
* @since 3.0.0 * @since 3.0.0
* *
* @param {any} [shape] - A geometric shape that defines the hit area for the Game Object. If not specified a Rectangle will be used. * @param {any} [shape] - A geometric shape that defines the hit area for the Game Object. If not specified a Rectangle will be used.
* @param {function} [callback] - A callback to be invoked when the Game Object is interacted with. * @param {HitAreaCallback} [callback] - A callback to be invoked when the Game Object is interacted with.
* @param {boolean} [dropZone=false] - Should this Game Object be treated as a drop zone target? * @param {boolean} [dropZone=false] - Should this Game Object be treated as a drop zone target?
* *
* @return {Phaser.GameObjects.GameObject} This GameObject. * @return {Phaser.GameObjects.GameObject} This GameObject.

View file

@ -10,6 +10,20 @@ var GameObject = require('../../GameObject');
var GetBitmapTextSize = require('../GetBitmapTextSize'); var GetBitmapTextSize = require('../GetBitmapTextSize');
var Render = require('./DynamicBitmapTextRender'); var Render = require('./DynamicBitmapTextRender');
/**
* @callback DisplayCallback
*
* @param {object} display - [description]
* @param {{topLeft:number,topRight:number,bottomLeft:number,bottomRight:number}} display.tint - [description]
* @param {number} display.index - [description]
* @param {number} display.charCode - [description]
* @param {number} display.x - [description]
* @param {number} display.y - [description]
* @param {number} display.scale - [description]
* @param {number} display.rotation - [description]
* @param {[type]} display.data - [description]
*/
/** /**
* @classdesc * @classdesc
* [description] * [description]
@ -161,7 +175,7 @@ var DynamicBitmapText = new Class({
* [description] * [description]
* *
* @name Phaser.GameObjects.DynamicBitmapText#displayCallback; * @name Phaser.GameObjects.DynamicBitmapText#displayCallback;
* @type {function} * @type {DisplayCallback}
* @since 3.0.0 * @since 3.0.0
*/ */
this.displayCallback; this.displayCallback;
@ -192,7 +206,7 @@ var DynamicBitmapText = new Class({
* @method Phaser.GameObjects.DynamicBitmapText#setDisplayCallback * @method Phaser.GameObjects.DynamicBitmapText#setDisplayCallback
* @since 3.0.0 * @since 3.0.0
* *
* @param {function} callback - [description] * @param {DisplayCallback} callback - [description]
* *
* @return {Phaser.GameObjects.DynamicBitmapText} This Game Object. * @return {Phaser.GameObjects.DynamicBitmapText} This Game Object.
*/ */
@ -286,21 +300,6 @@ var DynamicBitmapText = new Class({
return this; return this;
}, },
// {
// local: {
// x,
// y,
// width,
// height
// },
// global: {
// x,
// y,
// width,
// height
// }
// }
/** /**
* [description] * [description]
* *

View file

@ -12,6 +12,13 @@ var Frame = require('../../textures/Frame');
var GameObject = require('../GameObject'); var GameObject = require('../GameObject');
var List = require('../../structs/List'); var List = require('../../structs/List');
/**
* @callback BlitterFromCallback
*
* @param {Phaser.GameObjects.Blitter} blitter - [description]
* @param {integer} index - [description]
*/
/** /**
* @classdesc * @classdesc
* A Blitter Game Object. * A Blitter Game Object.
@ -44,7 +51,7 @@ var List = require('../../structs/List');
* @extends Phaser.GameObjects.Components.Texture * @extends Phaser.GameObjects.Components.Texture
* @extends Phaser.GameObjects.Components.Transform * @extends Phaser.GameObjects.Components.Transform
* @extends Phaser.GameObjects.Components.Visible * @extends Phaser.GameObjects.Components.Visible
* *
* @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. It can only belong to one Scene at any given time. * @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. It can only belong to one Scene at any given time.
* @param {number} [x=0] - The x coordinate of this Game Object in world space. * @param {number} [x=0] - The x coordinate of this Game Object in world space.
* @param {number} [y=0] - The y coordinate of this Game Object in world space. * @param {number} [y=0] - The y coordinate of this Game Object in world space.
@ -144,7 +151,7 @@ var Blitter = new Class({
* @method Phaser.GameObjects.Blitter#createFromCallback * @method Phaser.GameObjects.Blitter#createFromCallback
* @since 3.0.0 * @since 3.0.0
* *
* @param {function} callback - The callback to invoke after creating a bob. It will be sent two arguments: The Bob and the index of the Bob. * @param {BlitterFromCallback} callback - The callback to invoke after creating a bob. It will be sent two arguments: The Bob and the index of the Bob.
* @param {integer} quantity - The quantity of Bob objects to create. * @param {integer} quantity - The quantity of Bob objects to create.
* @param {string} [frame] - The Frame the Bobs will use. It must be part of the Blitter Texture. * @param {string} [frame] - The Frame the Bobs will use. It must be part of the Blitter Texture.
* @param {boolean} [visible=true] - [description] * @param {boolean} [visible=true] - [description]

View file

@ -9,6 +9,12 @@ var Light = require('./Light');
var LightPipeline = require('../../renderer/webgl/pipelines/ForwardDiffuseLightPipeline'); var LightPipeline = require('../../renderer/webgl/pipelines/ForwardDiffuseLightPipeline');
var Utils = require('../../renderer/webgl/Utils'); var Utils = require('../../renderer/webgl/Utils');
/**
* @callback LightForEach
*
* @param {Phaser.GameObjects.Light} light - [description]
*/
/** /**
* @classdesc * @classdesc
* [description] * [description]
@ -28,7 +34,7 @@ var LightsManager = new Class({
* [description] * [description]
* *
* @name Phaser.GameObjects.LightsManager#lightPool * @name Phaser.GameObjects.LightsManager#lightPool
* @type {array} * @type {Phaser.GameObjects.Light[]}
* @default [] * @default []
* @since 3.0.0 * @since 3.0.0
*/ */
@ -38,7 +44,7 @@ var LightsManager = new Class({
* [description] * [description]
* *
* @name Phaser.GameObjects.LightsManager#lights * @name Phaser.GameObjects.LightsManager#lights
* @type {array} * @type {Phaser.GameObjects.Light[]}
* @default [] * @default []
* @since 3.0.0 * @since 3.0.0
*/ */
@ -48,7 +54,7 @@ var LightsManager = new Class({
* [description] * [description]
* *
* @name Phaser.GameObjects.LightsManager#culledLights * @name Phaser.GameObjects.LightsManager#culledLights
* @type {array} * @type {Phaser.GameObjects.Light[]}
* @default [] * @default []
* @since 3.0.0 * @since 3.0.0
*/ */
@ -155,7 +161,7 @@ var LightsManager = new Class({
* @method Phaser.GameObjects.LightsManager#forEachLight * @method Phaser.GameObjects.LightsManager#forEachLight
* @since 3.0.0 * @since 3.0.0
* *
* @param {function} callback - [description] * @param {LightForEach} callback - [description]
* *
* @return {Phaser.GameObjects.LightsManager} This Lights Manager object. * @return {Phaser.GameObjects.LightsManager} This Lights Manager object.
*/ */

View file

@ -10,6 +10,29 @@ var GetEaseFunction = require('../../tweens/builders/GetEaseFunction');
var GetFastValue = require('../../utils/object/GetFastValue'); var GetFastValue = require('../../utils/object/GetFastValue');
var Wrap = require('../../math/Wrap'); var Wrap = require('../../math/Wrap');
/**
* The returned value sets what the property will be at the START of the particles life, on emit.
* @callback EmitterOpOnEmitCallback
*
* @param {Phaser.GameObjects.Particles.Particle} particle - [description]
* @param {string} key - [description]
* @param {number} value - [description]
*
* @return {number} [description]
*/
/**
* The returned value updates the property for the duration of the particles life.
* @callback EmitterOpOnUpdateCallback
*
* @param {Phaser.GameObjects.Particles.Particle} particle - [description]
* @param {string} key - [description]
* @param {float} t - The T value (between 0 and 1)
* @param {number} value - [description]
*
* @return {number} [description]
*/
/** /**
* @classdesc * @classdesc
* [description] * [description]
@ -121,7 +144,7 @@ var EmitterOp = new Class({
* [description] * [description]
* *
* @name Phaser.GameObjects.Particles.EmitterOp#onEmit * @name Phaser.GameObjects.Particles.EmitterOp#onEmit
* @type {function} * @type {EmitterOpOnEmitCallback}
* @since 3.0.0 * @since 3.0.0
*/ */
this.onEmit = this.defaultEmit; this.onEmit = this.defaultEmit;
@ -130,7 +153,7 @@ var EmitterOp = new Class({
* [description] * [description]
* *
* @name Phaser.GameObjects.Particles.EmitterOp#onUpdate * @name Phaser.GameObjects.Particles.EmitterOp#onUpdate
* @type {function} * @type {EmitterOpOnUpdateCallback}
* @since 3.0.0 * @since 3.0.0
*/ */
this.onUpdate = this.defaultUpdate; this.onUpdate = this.defaultUpdate;

View file

@ -21,6 +21,19 @@ var StableSort = require('../../utils/array/StableSort');
var Vector2 = require('../../math/Vector2'); var Vector2 = require('../../math/Vector2');
var Wrap = require('../../math/Wrap'); var Wrap = require('../../math/Wrap');
/**
* @callback ParticleEmitterCallback
*
* @param {Phaser.GameObjects.Particles.Particle} particle - [description]
* @param {Phaser.GameObjects.Particles.ParticleEmitter} emitter - [description]
*/
/**
* @callback ParticleDeathCallback
*
* @param {Phaser.GameObjects.Particles.Particle} particle - [description]
*/
/** /**
* @classdesc * @classdesc
* [description] * [description]
@ -400,7 +413,7 @@ var ParticleEmitter = new Class({
* [description] * [description]
* *
* @name Phaser.GameObjects.Particles.ParticleEmitter#emitCallback * @name Phaser.GameObjects.Particles.ParticleEmitter#emitCallback
* @type {?function} * @type {?ParticleEmitterCallback}
* @default null * @default null
* @since 3.0.0 * @since 3.0.0
*/ */
@ -410,7 +423,7 @@ var ParticleEmitter = new Class({
* [description] * [description]
* *
* @name Phaser.GameObjects.Particles.ParticleEmitter#emitCallbackScope * @name Phaser.GameObjects.Particles.ParticleEmitter#emitCallbackScope
* @type {?object} * @type {?any}
* @default null * @default null
* @since 3.0.0 * @since 3.0.0
*/ */
@ -420,7 +433,7 @@ var ParticleEmitter = new Class({
* [description] * [description]
* *
* @name Phaser.GameObjects.Particles.ParticleEmitter#deathCallback * @name Phaser.GameObjects.Particles.ParticleEmitter#deathCallback
* @type {?function} * @type {?ParticleDeathCallback}
* @default null * @default null
* @since 3.0.0 * @since 3.0.0
*/ */
@ -430,7 +443,7 @@ var ParticleEmitter = new Class({
* [description] * [description]
* *
* @name Phaser.GameObjects.Particles.ParticleEmitter#deathCallbackScope * @name Phaser.GameObjects.Particles.ParticleEmitter#deathCallbackScope
* @type {?object} * @type {?any}
* @default null * @default null
* @since 3.0.0 * @since 3.0.0
*/ */
@ -1534,7 +1547,7 @@ var ParticleEmitter = new Class({
* @method Phaser.GameObjects.Particles.ParticleEmitter#onParticleEmit * @method Phaser.GameObjects.Particles.ParticleEmitter#onParticleEmit
* @since 3.0.0 * @since 3.0.0
* *
* @param {function} callback - [description] * @param {ParticleEmitterCallback} callback - [description]
* @param {any} [context] - [description] * @param {any} [context] - [description]
* *
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
@ -1566,7 +1579,7 @@ var ParticleEmitter = new Class({
* @method Phaser.GameObjects.Particles.ParticleEmitter#onParticleDeath * @method Phaser.GameObjects.Particles.ParticleEmitter#onParticleDeath
* @since 3.0.0 * @since 3.0.0
* *
* @param {function} callback - [description] * @param {ParticleDeathCallback} callback - [description]
* @param {any} [context] - [description] * @param {any} [context] - [description]
* *
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
@ -1619,7 +1632,7 @@ var ParticleEmitter = new Class({
* @method Phaser.GameObjects.Particles.ParticleEmitter#forEachAlive * @method Phaser.GameObjects.Particles.ParticleEmitter#forEachAlive
* @since 3.0.0 * @since 3.0.0
* *
* @param {function} callback - [description] * @param {ParticleEmitterCallback} callback - [description]
* @param {any} thisArg - [description] * @param {any} thisArg - [description]
* *
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.
@ -1644,7 +1657,7 @@ var ParticleEmitter = new Class({
* @method Phaser.GameObjects.Particles.ParticleEmitter#forEachDead * @method Phaser.GameObjects.Particles.ParticleEmitter#forEachDead
* @since 3.0.0 * @since 3.0.0
* *
* @param {function} callback - [description] * @param {ParticleEmitterCallback} callback - [description]
* @param {any} thisArg - [description] * @param {any} thisArg - [description]
* *
* @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter. * @return {Phaser.GameObjects.Particles.ParticleEmitter} This Particle Emitter.

View file

@ -11,6 +11,17 @@ var MeasureText = require('./MeasureText');
// Key: [ Object Key, Default Value ] // Key: [ Object Key, Default Value ]
/**
* A custom function that will be responsible for wrapping the text.
* @callback TextStyleWordWrapCallback
*
* @param {string} text - The string to wrap.
* @param {Phaser.GameObjects.Text} textObject - The Text instance.
*
* @return {(string|string[])} Should return the wrapped lines either as an array of lines or as a string with
* newline characters in place to indicate where breaks should happen.
*/
var propertyMap = { var propertyMap = {
fontFamily: [ 'fontFamily', 'Courier' ], fontFamily: [ 'fontFamily', 'Courier' ],
fontSize: [ 'fontSize', '16px' ], fontSize: [ 'fontSize', '16px' ],
@ -820,7 +831,7 @@ var TextStyle = new Class({
* @method Phaser.GameObjects.Components.TextStyle#setWordWrapCallback * @method Phaser.GameObjects.Components.TextStyle#setWordWrapCallback
* @since 3.0.0 * @since 3.0.0
* *
* @param {function} callback - A custom function that will be responsible for wrapping the * @param {TextStyleWordWrapCallback} callback - A custom function that will be responsible for wrapping the
* text. It will receive two arguments: text (the string to wrap), textObject (this Text * text. It will receive two arguments: text (the string to wrap), textObject (this Text
* instance). It should return the wrapped lines either as an array of lines or as a string with * instance). It should return the wrapped lines either as an array of lines or as a string with
* newline characters in place to indicate where breaks should happen. * newline characters in place to indicate where breaks should happen.

View file

@ -795,7 +795,7 @@ var Text = new Class({
* @method Phaser.GameObjects.Text#setWordWrapCallback * @method Phaser.GameObjects.Text#setWordWrapCallback
* @since 3.0.0 * @since 3.0.0
* *
* @param {function} callback - A custom function that will be responsible for wrapping the * @param {TextStyleWordWrapCallback} callback - A custom function that will be responsible for wrapping the
* text. It will receive two arguments: text (the string to wrap), textObject (this Text * text. It will receive two arguments: text (the string to wrap), textObject (this Text
* instance). It should return the wrapped lines either as an array of lines or as a string with * instance). It should return the wrapped lines either as an array of lines or as a string with
* newline characters in place to indicate where breaks should happen. * newline characters in place to indicate where breaks should happen.

View file

@ -105,7 +105,7 @@ var Zone = new Class({
/** /**
* The displayed width of this Game Object. * The displayed width of this Game Object.
* This value takes into account the scale factor. * This value takes into account the scale factor.
* *
* @name Phaser.GameObjects.Zone#displayWidth * @name Phaser.GameObjects.Zone#displayWidth
* @type {number} * @type {number}
* @since 3.0.0 * @since 3.0.0
@ -127,7 +127,7 @@ var Zone = new Class({
/** /**
* The displayed height of this Game Object. * The displayed height of this Game Object.
* This value takes into account the scale factor. * This value takes into account the scale factor.
* *
* @name Phaser.GameObjects.Zone#displayHeight * @name Phaser.GameObjects.Zone#displayHeight
* @type {number} * @type {number}
* @since 3.0.0 * @since 3.0.0
@ -237,7 +237,7 @@ var Zone = new Class({
* @since 3.0.0 * @since 3.0.0
* *
* @param {object} shape - A Geometry shape instance, such as Phaser.Geom.Ellipse, or your own custom shape. * @param {object} shape - A Geometry shape instance, such as Phaser.Geom.Ellipse, or your own custom shape.
* @param {function} callback - A function that will return `true` if the given x/y coords it is sent are within the shape. * @param {HitAreaCallback} callback - A function that will return `true` if the given x/y coords it is sent are within the shape.
* *
* @return {Phaser.GameObjects.Zone} This Game Object. * @return {Phaser.GameObjects.Zone} This Game Object.
*/ */

View file

@ -7,6 +7,14 @@
var Centroid = require('./Centroid'); var Centroid = require('./Centroid');
var Offset = require('./Offset'); var Offset = require('./Offset');
/**
* @callback CenterFunction
*
* @param {Phaser.Geom.Triangle} triangle - [description]
*
* @return {Phaser.Math.Vector2} [description]
*/
/** /**
* [description] * [description]
* *
@ -16,7 +24,7 @@ var Offset = require('./Offset');
* @param {Phaser.Geom.Triangle} triangle - [description] * @param {Phaser.Geom.Triangle} triangle - [description]
* @param {number} x - [description] * @param {number} x - [description]
* @param {number} y - [description] * @param {number} y - [description]
* @param {function} [centerFunc] - [description] * @param {CenterFunction} [centerFunc] - [description]
* *
* @return {Phaser.Geom.Triangle} [description] * @return {Phaser.Geom.Triangle} [description]
*/ */

View file

@ -402,7 +402,7 @@ var InputPlugin = new Class({
* *
* @param {Phaser.GameObjects.GameObject} gameObject - [description] * @param {Phaser.GameObjects.GameObject} gameObject - [description]
* @param {object} shape - [description] * @param {object} shape - [description]
* @param {function} callback - [description] * @param {HitAreaCallback} callback - [description]
* @param {boolean} [dropZone=false] - [description] * @param {boolean} [dropZone=false] - [description]
* *
* @return {Phaser.Input.InputPlugin} This Input Plugin. * @return {Phaser.Input.InputPlugin} This Input Plugin.
@ -1053,7 +1053,7 @@ var InputPlugin = new Class({
* *
* @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} gameObjects - An array of Game Objects to set the hit area on. * @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} gameObjects - An array of Game Objects to set the hit area on.
* @param {object} [shape] - The shape or object to check if the pointer is within for hit area checks. * @param {object} [shape] - The shape or object to check if the pointer is within for hit area checks.
* @param {function} [callback] - The 'contains' function to invoke to check if the pointer is within the hit area. * @param {HitAreaCallback} [callback] - The 'contains' function to invoke to check if the pointer is within the hit area.
* *
* @return {Phaser.Input.InputPlugin} This InputPlugin object. * @return {Phaser.Input.InputPlugin} This InputPlugin object.
*/ */
@ -1091,7 +1091,7 @@ var InputPlugin = new Class({
* @param {number} x - The center of the circle. * @param {number} x - The center of the circle.
* @param {number} y - The center of the circle. * @param {number} y - The center of the circle.
* @param {number} radius - The radius of the circle. * @param {number} radius - The radius of the circle.
* @param {function} [callback] - The hit area callback. If undefined it uses Circle.Contains. * @param {HitAreaCallback} [callback] - The hit area callback. If undefined it uses Circle.Contains.
* *
* @return {Phaser.Input.InputPlugin} This InputPlugin object. * @return {Phaser.Input.InputPlugin} This InputPlugin object.
*/ */
@ -1115,7 +1115,7 @@ var InputPlugin = new Class({
* @param {number} y - The center of the ellipse. * @param {number} y - The center of the ellipse.
* @param {number} width - The width of the ellipse. * @param {number} width - The width of the ellipse.
* @param {number} height - The height of the ellipse. * @param {number} height - The height of the ellipse.
* @param {function} [callback] - The hit area callback. If undefined it uses Ellipse.Contains. * @param {HitAreaCallback} [callback] - The hit area callback. If undefined it uses Ellipse.Contains.
* *
* @return {Phaser.Input.InputPlugin} This InputPlugin object. * @return {Phaser.Input.InputPlugin} This InputPlugin object.
*/ */
@ -1135,7 +1135,7 @@ var InputPlugin = new Class({
* @since 3.0.0 * @since 3.0.0
* *
* @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} gameObjects - An array of Game Objects to set as having an ellipse hit area. * @param {Phaser.GameObjects.GameObject|Phaser.GameObjects.GameObject[]} gameObjects - An array of Game Objects to set as having an ellipse hit area.
* @param {function} [callback] - The hit area callback. If undefined it uses Rectangle.Contains. * @param {HitAreaCallback} [callback] - The hit area callback. If undefined it uses Rectangle.Contains.
* *
* @return {Phaser.Input.InputPlugin} This InputPlugin object. * @return {Phaser.Input.InputPlugin} This InputPlugin object.
*/ */
@ -1189,7 +1189,7 @@ var InputPlugin = new Class({
* @param {number} y - The top-left of the rectangle. * @param {number} y - The top-left of the rectangle.
* @param {number} width - The width of the rectangle. * @param {number} width - The width of the rectangle.
* @param {number} height - The height of the rectangle. * @param {number} height - The height of the rectangle.
* @param {function} [callback] - The hit area callback. If undefined it uses Rectangle.Contains. * @param {HitAreaCallback} [callback] - The hit area callback. If undefined it uses Rectangle.Contains.
* *
* @return {Phaser.Input.InputPlugin} This InputPlugin object. * @return {Phaser.Input.InputPlugin} This InputPlugin object.
*/ */
@ -1215,7 +1215,7 @@ var InputPlugin = new Class({
* @param {number} y2 - The y coordinate of the second point of the triangle. * @param {number} y2 - The y coordinate of the second point of the triangle.
* @param {number} x3 - The x coordinate of the third point of the triangle. * @param {number} x3 - The x coordinate of the third point of the triangle.
* @param {number} y3 - The y coordinate of the third point of the triangle. * @param {number} y3 - The y coordinate of the third point of the triangle.
* @param {function} [callback] - The hit area callback. If undefined it uses Triangle.Contains. * @param {HitAreaCallback} [callback] - The hit area callback. If undefined it uses Triangle.Contains.
* *
* @return {Phaser.Input.InputPlugin} This InputPlugin object. * @return {Phaser.Input.InputPlugin} This InputPlugin object.
*/ */

View file

@ -6,6 +6,49 @@
// Phaser.Input.InteractiveObject // Phaser.Input.InteractiveObject
/**
* @callback HitAreaCallback
*
* @param {any} hitArea - [description]
* @param {number} x - [description]
* @param {number} y - [description]
* @param {Phaser.GameObjects.GameObject} gameObject - [description]
*
* @return {boolean} [description]
*/
/**
* @typedef {object} InteractiveObject
*
* @property {Phaser.GameObjects.GameObject} gameObject - [description]
* @property {boolean} enabled - [description]
* @property {boolean} draggable - [description]
* @property {boolean} dropZone - [description]
* @property {[type]} target - [description]
* @property {Phaser.Cameras.Scene2D.Camera} camera - [description]
* @property {any} hitArea - [description]
* @property {HitAreaCallback} hitAreaCallback - [description]
* @property {number} localX - [description]
* @property {number} localY - [description]
* @property {(0|1|2)} dragState - [description]
* @property {number} dragStartX - [description]
* @property {number} dragStartY - [description]
* @property {number} dragX - [description]
* @property {number} dragY - [description]
*/
/**
* [description]
*
* @method Phaser.Input.Pointer#positionToCamera
* @since 3.0.0
*
* @param {Phaser.GameObjects.GameObject} gameObject - [description]
* @param {any} hitArea - [description]
* @param {HitAreaCallback} hitAreaCallback - [description]
*
* @return {InteractiveObject} [description]
*/
var InteractiveObject = function (gameObject, hitArea, hitAreaCallback) var InteractiveObject = function (gameObject, hitArea, hitAreaCallback)
{ {
return { return {

View file

@ -9,6 +9,12 @@ var GetFastValue = require('../../../utils/object/GetFastValue');
var ProcessKeyCombo = require('./ProcessKeyCombo'); var ProcessKeyCombo = require('./ProcessKeyCombo');
var ResetKeyCombo = require('./ResetKeyCombo'); var ResetKeyCombo = require('./ResetKeyCombo');
/**
* @callback KeyboardKeydownCallback
*
* @param {KeyboardEvent} event - [description]
*/
/** /**
* @classdesc * @classdesc
* [description] * [description]
@ -219,7 +225,7 @@ var KeyCombo = new Class({
* [description] * [description]
* *
* @name Phaser.Input.Keyboard.KeyCombo#onKeyDown * @name Phaser.Input.Keyboard.KeyCombo#onKeyDown
* @type {function} * @type {KeyboardKeydownCallback}
* @since 3.0.0 * @since 3.0.0
*/ */
this.onKeyDown = onKeyDownHandler; this.onKeyDown = onKeyDownHandler;

View file

@ -10,6 +10,12 @@ var Class = require('../../utils/Class');
// https://patrickhlauke.github.io/touch/tests/results/ // https://patrickhlauke.github.io/touch/tests/results/
// https://www.html5rocks.com/en/mobile/touch/ // https://www.html5rocks.com/en/mobile/touch/
/**
* @callback TouchHandler
*
* @param {TouchEvent} event - [description]
*/
/** /**
* @classdesc * @classdesc
* [description] * [description]
@ -69,7 +75,7 @@ var TouchManager = new Class({
* [description] * [description]
* *
* @name Phaser.Input.Touch.TouchManager#handler * @name Phaser.Input.Touch.TouchManager#handler
* @type {function} * @type {TouchHandler}
* @since 3.0.0 * @since 3.0.0
*/ */
this.handler; this.handler;
@ -154,7 +160,7 @@ var TouchManager = new Class({
target.addEventListener('touchmove', handler, passive); target.addEventListener('touchmove', handler, passive);
target.addEventListener('touchend', handler, passive); target.addEventListener('touchend', handler, passive);
} }
this.handler = handler; this.handler = handler;
}, },

View file

@ -12,6 +12,12 @@ var MergeXHRSettings = require('./MergeXHRSettings');
var XHRLoader = require('./XHRLoader'); var XHRLoader = require('./XHRLoader');
var XHRSettings = require('./XHRSettings'); var XHRSettings = require('./XHRSettings');
/**
* @callback FileProcessCallback
*
* @param {Phaser.Loader.File} file - [description]
*/
/** /**
* @classdesc * @classdesc
* [description] * [description]
@ -31,7 +37,7 @@ var File = new Class({
{ {
/** /**
* The file type string (image, json, etc) for sorting within the Loader. * The file type string (image, json, etc) for sorting within the Loader.
* *
* @name Phaser.Loader.File#type * @name Phaser.Loader.File#type
* @type {string} * @type {string}
* @since 3.0.0 * @since 3.0.0
@ -219,7 +225,7 @@ var File = new Class({
* *
* @method Phaser.Loader.File#setLinkFile * @method Phaser.Loader.File#setLinkFile
* @since 3.0.0 * @since 3.0.0
* *
* @param {Phaser.Loader.File} fileB - The linked file. * @param {Phaser.Loader.File} fileB - The linked file.
* @param {string} linkType - The type of association. * @param {string} linkType - The type of association.
*/ */
@ -350,7 +356,7 @@ var File = new Class({
* @method Phaser.Loader.File#onProcess * @method Phaser.Loader.File#onProcess
* @since 3.0.0 * @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) onProcess: function (callback)
{ {

View file

@ -62,7 +62,7 @@ var AudioFile = new Class({
* @method Phaser.Loader.FileTypes.AudioFile#onProcess * @method Phaser.Loader.FileTypes.AudioFile#onProcess
* @since 3.0.0 * @since 3.0.0
* *
* @param {function} callback - [description] * @param {FileProcessCallback} callback - [description]
*/ */
onProcess: function (callback) onProcess: function (callback)
{ {

View file

@ -144,8 +144,8 @@ var ArcadePhysics = new Class({
* *
* @param {Phaser.GameObjects.GameObject|array} object1 - The first object or array of objects to check. Can be any Game Object that has an Arcade Physics Body. * @param {Phaser.GameObjects.GameObject|array} object1 - The first object or array of objects to check. Can be any Game Object that has an Arcade Physics Body.
* @param {Phaser.GameObjects.GameObject|array} object2 - The second object or array of objects to check. Can be any Game Object that has an Arcade Physics Body. * @param {Phaser.GameObjects.GameObject|array} object2 - The second object or array of objects to check. Can be any Game Object that has an Arcade Physics Body.
* @param {function} [overlapCallback=null] - An optional callback function that is called if the objects overlap. The two objects will be passed to this function in the same order in which you specified them, unless you are checking Group vs. Sprite, in which case Sprite will always be the first parameter. * @param {ArcadePhysicsCallback} [overlapCallback=null] - An optional callback function that is called if the objects overlap. The two objects will be passed to this function in the same order in which you specified them, unless you are checking Group vs. Sprite, in which case Sprite will always be the first parameter.
* @param {function} [processCallback=null] - A callback function that lets you perform additional checks against the two objects if they overlap. If this is set then `overlapCallback` will only be called if this callback returns `true`. * @param {ArcadePhysicsCallback} [processCallback=null] - A callback function that lets you perform additional checks against the two objects if they overlap. If this is set then `overlapCallback` will only be called if this callback returns `true`.
* @param {object} [callbackContext] - The context in which to run the callbacks. * @param {object} [callbackContext] - The context in which to run the callbacks.
* *
* @return {boolean} True if an overlap occurred otherwise false. * @return {boolean} True if an overlap occurred otherwise false.
@ -167,8 +167,8 @@ var ArcadePhysics = new Class({
* *
* @param {Phaser.GameObjects.GameObject|array} object1 - The first object or array of objects to check. Can be any Game Object that has an Arcade Physics Body. * @param {Phaser.GameObjects.GameObject|array} object1 - The first object or array of objects to check. Can be any Game Object that has an Arcade Physics Body.
* @param {Phaser.GameObjects.GameObject|array} object2 - The second object or array of objects to check. Can be any Game Object that has an Arcade Physics Body. * @param {Phaser.GameObjects.GameObject|array} object2 - The second object or array of objects to check. Can be any Game Object that has an Arcade Physics Body.
* @param {function} [collideCallback=null] - An optional callback function that is called if the objects collide. The two objects will be passed to this function in the same order in which you specified them, unless you are checking Group vs. Sprite, in which case Sprite will always be the first parameter. * @param {ArcadePhysicsCallback} [collideCallback=null] - An optional callback function that is called if the objects collide. The two objects will be passed to this function in the same order in which you specified them, unless you are checking Group vs. Sprite, in which case Sprite will always be the first parameter.
* @param {function} [processCallback=null] - A callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`. * @param {ArcadePhysicsCallback} [processCallback=null] - A callback function that lets you perform additional checks against the two objects if they collide. If this is set then `collideCallback` will only be called if this callback returns `true`.
* @param {object} [callbackContext] - The context in which to run the callbacks. * @param {object} [callbackContext] - The context in which to run the callbacks.
* *
* @return {boolean} True if a collision occurred otherwise false. * @return {boolean} True if a collision occurred otherwise false.

View file

@ -19,8 +19,8 @@ var Class = require('../../utils/Class');
* @param {boolean} overlapOnly - [description] * @param {boolean} overlapOnly - [description]
* @param {Phaser.Physics.Arcade.Body} object1 - The first object to check for collision. * @param {Phaser.Physics.Arcade.Body} object1 - The first object to check for collision.
* @param {Phaser.Physics.Arcade.Body} object2 - The second object to check for collision. * @param {Phaser.Physics.Arcade.Body} object2 - The second object to check for collision.
* @param {function} collideCallback - The callback to invoke when the two objects collide. * @param {ArcadePhysicsCallback} collideCallback - The callback to invoke when the two objects collide.
* @param {function} processCallback - The callback to invoke when the two objects collide. Must return a boolean. * @param {ArcadePhysicsCallback} processCallback - The callback to invoke when the two objects collide. Must return a boolean.
* @param {object} callbackContext - The scope in which to call the callbacks. * @param {object} callbackContext - The scope in which to call the callbacks.
*/ */
var Collider = new Class({ var Collider = new Class({
@ -88,7 +88,7 @@ var Collider = new Class({
* [description] * [description]
* *
* @name Phaser.Physics.Arcade.Collider#collideCallback * @name Phaser.Physics.Arcade.Collider#collideCallback
* @type {function} * @type {ArcadePhysicsCallback}
* @since 3.0.0 * @since 3.0.0
*/ */
this.collideCallback = collideCallback; this.collideCallback = collideCallback;
@ -97,7 +97,7 @@ var Collider = new Class({
* [description] * [description]
* *
* @name Phaser.Physics.Arcade.Collider#processCallback * @name Phaser.Physics.Arcade.Collider#processCallback
* @type {function} * @type {ArcadePhysicsCallback}
* @since 3.0.0 * @since 3.0.0
*/ */
this.processCallback = processCallback; this.processCallback = processCallback;

View file

@ -65,8 +65,8 @@ var Factory = new Class({
* *
* @param {Phaser.Physics.Arcade.Body} object1 - The first object to check for collision. * @param {Phaser.Physics.Arcade.Body} object1 - The first object to check for collision.
* @param {Phaser.Physics.Arcade.Body} object2 - The second object to check for collision. * @param {Phaser.Physics.Arcade.Body} object2 - The second object to check for collision.
* @param {function} collideCallback - The callback to invoke when the two objects collide. * @param {ArcadePhysicsCallback} collideCallback - The callback to invoke when the two objects collide.
* @param {function} processCallback - The callback to invoke when the two objects collide. Must return a boolean. * @param {ArcadePhysicsCallback} processCallback - The callback to invoke when the two objects collide. Must return a boolean.
* @param {object} callbackContext - The scope in which to call the callbacks. * @param {object} callbackContext - The scope in which to call the callbacks.
* *
* @return {Phaser.Physics.Arcade.Collider} The Collider that was created. * @return {Phaser.Physics.Arcade.Collider} The Collider that was created.
@ -84,8 +84,8 @@ var Factory = new Class({
* *
* @param {Phaser.Physics.Arcade.Body} object1 - The first object to check for overlap. * @param {Phaser.Physics.Arcade.Body} object1 - The first object to check for overlap.
* @param {Phaser.Physics.Arcade.Body} object2 - The second object to check for overlap. * @param {Phaser.Physics.Arcade.Body} object2 - The second object to check for overlap.
* @param {function} collideCallback - The callback to invoke when the two objects collide. * @param {ArcadePhysicsCallback} collideCallback - The callback to invoke when the two objects collide.
* @param {function} processCallback - The callback to invoke when the two objects collide. Must return a boolean. * @param {ArcadePhysicsCallback} processCallback - The callback to invoke when the two objects collide. Must return a boolean.
* @param {object} callbackContext - The scope in which to call the callbacks. * @param {object} callbackContext - The scope in which to call the callbacks.
* *
* @return {Phaser.Physics.Arcade.Collider} The Collider that was created. * @return {Phaser.Physics.Arcade.Collider} The Collider that was created.

View file

@ -565,9 +565,9 @@ var World = new Class({
* *
* @param {Phaser.Physics.Arcade.Body} object1 - The first object to check for collision. * @param {Phaser.Physics.Arcade.Body} object1 - The first object to check for collision.
* @param {Phaser.Physics.Arcade.Body} object2 - The second object to check for collision. * @param {Phaser.Physics.Arcade.Body} object2 - The second object to check for collision.
* @param {function} collideCallback - The callback to invoke when the two objects collide. * @param {ArcadePhysicsCallback} [collideCallback] - The callback to invoke when the two objects collide.
* @param {function} processCallback - The callback to invoke when the two objects collide. Must return a boolean. * @param {ArcadePhysicsCallback} [processCallback] - The callback to invoke when the two objects collide. Must return a boolean.
* @param {object} callbackContext - The scope in which to call the callbacks. * @param {object} [callbackContext] - The scope in which to call the callbacks.
* *
* @return {Phaser.Physics.Arcade.Collider} The Collider that was created. * @return {Phaser.Physics.Arcade.Collider} The Collider that was created.
*/ */
@ -592,9 +592,9 @@ var World = new Class({
* *
* @param {Phaser.Physics.Arcade.Body} object1 - The first object to check for overlap. * @param {Phaser.Physics.Arcade.Body} object1 - The first object to check for overlap.
* @param {Phaser.Physics.Arcade.Body} object2 - The second object to check for overlap. * @param {Phaser.Physics.Arcade.Body} object2 - The second object to check for overlap.
* @param {function} collideCallback - The callback to invoke when the two objects overlap. * @param {ArcadePhysicsCallback} [collideCallback] - The callback to invoke when the two objects overlap.
* @param {function} processCallback - The callback to invoke when the two objects overlap. Must return a boolean. * @param {ArcadePhysicsCallback} [processCallback] - The callback to invoke when the two objects overlap. Must return a boolean.
* @param {object} callbackContext - The scope in which to call the callbacks. * @param {object} [callbackContext] - The scope in which to call the callbacks.
* *
* @return {Phaser.Physics.Arcade.Collider} The Collider that was created. * @return {Phaser.Physics.Arcade.Collider} The Collider that was created.
*/ */
@ -865,7 +865,7 @@ var World = new Class({
* *
* @param {Phaser.Physics.Arcade.Body} body1 - [description] * @param {Phaser.Physics.Arcade.Body} body1 - [description]
* @param {Phaser.Physics.Arcade.Body} body2 - [description] * @param {Phaser.Physics.Arcade.Body} body2 - [description]
* @param {function} processCallback - [description] * @param {ArcadePhysicsCallback} processCallback - [description]
* @param {object} callbackContext - [description] * @param {object} callbackContext - [description]
* @param {boolean} overlapOnly - [description] * @param {boolean} overlapOnly - [description]
* *
@ -1249,9 +1249,9 @@ var World = new Class({
* *
* @param {Phaser.GameObjects.GameObject} object1 - [description] * @param {Phaser.GameObjects.GameObject} object1 - [description]
* @param {Phaser.GameObjects.GameObject} object2 - [description] * @param {Phaser.GameObjects.GameObject} object2 - [description]
* @param {function} overlapCallback - [description] * @param {ArcadePhysicsCallback} [overlapCallback] - [description]
* @param {function} processCallback - [description] * @param {ArcadePhysicsCallback} [processCallback] - [description]
* @param {object} callbackContext - [description] * @param {object} [callbackContext] - [description]
* *
* @return {boolean} [description] * @return {boolean} [description]
*/ */
@ -1272,9 +1272,9 @@ var World = new Class({
* *
* @param {Phaser.GameObjects.GameObject} object1 - [description] * @param {Phaser.GameObjects.GameObject} object1 - [description]
* @param {Phaser.GameObjects.GameObject} object2 - [description] * @param {Phaser.GameObjects.GameObject} object2 - [description]
* @param {function} collideCallback - [description] * @param {ArcadePhysicsCallback} [collideCallback] - [description]
* @param {function} processCallback - [description] * @param {ArcadePhysicsCallback} [processCallback] - [description]
* @param {object} callbackContext - [description] * @param {object} [callbackContext] - [description]
* *
* @return {boolean} [description] * @return {boolean} [description]
*/ */
@ -1295,8 +1295,8 @@ var World = new Class({
* *
* @param {Phaser.GameObjects.GameObject} object1 - [description] * @param {Phaser.GameObjects.GameObject} object1 - [description]
* @param {Phaser.GameObjects.GameObject} object2 - [description] * @param {Phaser.GameObjects.GameObject} object2 - [description]
* @param {function} collideCallback - [description] * @param {ArcadePhysicsCallback} collideCallback - [description]
* @param {function} processCallback - [description] * @param {ArcadePhysicsCallback} processCallback - [description]
* @param {object} callbackContext - [description] * @param {object} callbackContext - [description]
* @param {boolean} overlapOnly - [description] * @param {boolean} overlapOnly - [description]
* *
@ -1356,8 +1356,8 @@ var World = new Class({
* *
* @param {Phaser.GameObjects.GameObject} object1 - [description] * @param {Phaser.GameObjects.GameObject} object1 - [description]
* @param {Phaser.GameObjects.GameObject} object2 - [description] * @param {Phaser.GameObjects.GameObject} object2 - [description]
* @param {function} collideCallback - [description] * @param {ArcadePhysicsCallback} collideCallback - [description]
* @param {function} processCallback - [description] * @param {ArcadePhysicsCallback} processCallback - [description]
* @param {object} callbackContext - [description] * @param {object} callbackContext - [description]
* @param {boolean} overlapOnly - [description] * @param {boolean} overlapOnly - [description]
* *
@ -1434,8 +1434,8 @@ var World = new Class({
* *
* @param {Phaser.GameObjects.GameObject} sprite1 - [description] * @param {Phaser.GameObjects.GameObject} sprite1 - [description]
* @param {Phaser.GameObjects.GameObject} sprite2 - [description] * @param {Phaser.GameObjects.GameObject} sprite2 - [description]
* @param {function} collideCallback - [description] * @param {ArcadePhysicsCallback} collideCallback - [description]
* @param {function} processCallback - [description] * @param {ArcadePhysicsCallback} processCallback - [description]
* @param {object} callbackContext - [description] * @param {object} callbackContext - [description]
* @param {boolean} overlapOnly - [description] * @param {boolean} overlapOnly - [description]
* *
@ -1469,8 +1469,8 @@ var World = new Class({
* *
* @param {Phaser.GameObjects.GameObject} sprite - [description] * @param {Phaser.GameObjects.GameObject} sprite - [description]
* @param {Phaser.GameObjects.Group} group - [description] * @param {Phaser.GameObjects.Group} group - [description]
* @param {function} collideCallback - [description] * @param {ArcadePhysicsCallback} collideCallback - [description]
* @param {function} processCallback - [description] * @param {ArcadePhysicsCallback} processCallback - [description]
* @param {object} callbackContext - [description] * @param {object} callbackContext - [description]
* @param {boolean} overlapOnly - [description] * @param {boolean} overlapOnly - [description]
* *
@ -1532,8 +1532,8 @@ var World = new Class({
* *
* @param {Phaser.GameObjects.Group} group - [description] * @param {Phaser.GameObjects.Group} group - [description]
* @param {Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer} tilemapLayer - [description] * @param {Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer} tilemapLayer - [description]
* @param {function} collideCallback - [description] * @param {ArcadePhysicsCallback} collideCallback - [description]
* @param {function} processCallback - [description] * @param {ArcadePhysicsCallback} processCallback - [description]
* @param {object} callbackContext - [description] * @param {object} callbackContext - [description]
* @param {boolean} overlapOnly - [description] * @param {boolean} overlapOnly - [description]
* *
@ -1572,8 +1572,8 @@ var World = new Class({
* *
* @param {Phaser.GameObjects.GameObject} sprite - [description] * @param {Phaser.GameObjects.GameObject} sprite - [description]
* @param {Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer} tilemapLayer - [description] * @param {Phaser.Tilemaps.DynamicTilemapLayer|Phaser.Tilemaps.StaticTilemapLayer} tilemapLayer - [description]
* @param {function} collideCallback - [description] * @param {ArcadePhysicsCallback} collideCallback - [description]
* @param {function} processCallback - [description] * @param {ArcadePhysicsCallback} processCallback - [description]
* @param {object} callbackContext - [description] * @param {object} callbackContext - [description]
* @param {boolean} overlapOnly - [description] * @param {boolean} overlapOnly - [description]
* *
@ -1671,8 +1671,8 @@ var World = new Class({
* *
* @param {Phaser.GameObjects.Group} group1 - [description] * @param {Phaser.GameObjects.Group} group1 - [description]
* @param {Phaser.GameObjects.Group} group2 - [description] * @param {Phaser.GameObjects.Group} group2 - [description]
* @param {function} collideCallback - [description] * @param {ArcadePhysicsCallback} collideCallback - [description]
* @param {function} processCallback - [description] * @param {ArcadePhysicsCallback} processCallback - [description]
* @param {object} callbackContext - [description] * @param {object} callbackContext - [description]
* @param {boolean} overlapOnly - [description] * @param {boolean} overlapOnly - [description]
* *

View file

@ -7,6 +7,13 @@
var CONST = require('./const'); var CONST = require('./const');
var Extend = require('../../utils/object/Extend'); var Extend = require('../../utils/object/Extend');
/**
* @callback ArcadePhysicsCallback
*
* @param {Phaser.GameObjects.GameObject} object1 - [description]
* @param {Phaser.GameObjects.GameObject} object2 - [description]
*/
/** /**
* @namespace Phaser.Physics.Arcade * @namespace Phaser.Physics.Arcade
*/ */
@ -23,7 +30,7 @@ var Arcade = {
StaticBody: require('./StaticBody'), StaticBody: require('./StaticBody'),
StaticGroup: require('./StaticPhysicsGroup'), StaticGroup: require('./StaticPhysicsGroup'),
World: require('./World') World: require('./World')
}; };
// Merge in the consts // Merge in the consts

View file

@ -10,6 +10,12 @@ var GetVelocity = require('./GetVelocity');
var TYPE = require('./TYPE'); var TYPE = require('./TYPE');
var UpdateMotion = require('./UpdateMotion'); var UpdateMotion = require('./UpdateMotion');
/**
* @callback BodyUpdateCallback
*
* @param {Phaser.Physics.Impact.Body} body - [description]
*/
/** /**
* @classdesc * @classdesc
* An Impact.js compatible physics body. * An Impact.js compatible physics body.
@ -289,7 +295,7 @@ var Body = new Class({
* [description] * [description]
* *
* @name Phaser.Physics.Impact.Body#updateCallback * @name Phaser.Physics.Impact.Body#updateCallback
* @type {function} * @type {?BodyUpdateCallback}
* @since 3.0.0 * @since 3.0.0
*/ */
this.updateCallback; this.updateCallback;

View file

@ -6,6 +6,14 @@
var COLLIDES = require('../COLLIDES'); 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] * [description]
* *
@ -23,7 +31,7 @@ var Collides = {
* @method Phaser.Physics.Impact.Components.Collides#setCollideCallback * @method Phaser.Physics.Impact.Components.Collides#setCollideCallback
* @since 3.0.0 * @since 3.0.0
* *
* @param {function} callback - [description] * @param {CollideCallback} callback - [description]
* @param {object} scope - [description] * @param {object} scope - [description]
* *
* @return {Phaser.GameObjects.GameObject} This Game Object. * @return {Phaser.GameObjects.GameObject} This Game Object.

View file

@ -132,7 +132,7 @@ var CanvasRenderer = new Class({
* Map to the required function. * Map to the required function.
* *
* @name Phaser.Renderer.Canvas.CanvasRenderer#drawImage * @name Phaser.Renderer.Canvas.CanvasRenderer#drawImage
* @type {function} * @type {Phaser.Renderer.Canvas.DrawImage}
* @since 3.0.0 * @since 3.0.0
*/ */
this.drawImage = DrawImage(this.config.roundPixels); this.drawImage = DrawImage(this.config.roundPixels);
@ -141,7 +141,7 @@ var CanvasRenderer = new Class({
* [description] * [description]
* *
* @name Phaser.Renderer.Canvas.CanvasRenderer#blitImage * @name Phaser.Renderer.Canvas.CanvasRenderer#blitImage
* @type {function} * @type {Phaser.Renderer.Canvas.BlitImage}
* @since 3.0.0 * @since 3.0.0
*/ */
this.blitImage = BlitImage(this.config.roundPixels); this.blitImage = BlitImage(this.config.roundPixels);
@ -189,7 +189,7 @@ var CanvasRenderer = new Class({
* [description] * [description]
* *
* @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotCallback * @name Phaser.Renderer.Canvas.CanvasRenderer#snapshotCallback
* @type {?function} * @type {?SnapshotCallback}
* @default null * @default null
* @since 3.0.0 * @since 3.0.0
*/ */
@ -494,7 +494,7 @@ var CanvasRenderer = new Class({
* @method Phaser.Renderer.Canvas.CanvasRenderer#snapshot * @method Phaser.Renderer.Canvas.CanvasRenderer#snapshot
* @since 3.0.0 * @since 3.0.0
* *
* @param {function} callback - [description] * @param {SnapshotCallback} callback - [description]
* @param {string} type - [description] * @param {string} type - [description]
* @param {number} encoderOptions - [description] * @param {number} encoderOptions - [description]
*/ */

View file

@ -4,6 +4,12 @@
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/ */
/**
* @callback SnapshotCallback
*
* @param {HTMLImageElement} snapshot - [description]
*/
/** /**
* @namespace Phaser.Renderer.Snapshot * @namespace Phaser.Renderer.Snapshot
*/ */

View file

@ -16,6 +16,12 @@ var FlatTintPipeline = require('./pipelines/FlatTintPipeline');
var ForwardDiffuseLightPipeline = require('./pipelines/ForwardDiffuseLightPipeline'); var ForwardDiffuseLightPipeline = require('./pipelines/ForwardDiffuseLightPipeline');
var TextureTintPipeline = require('./pipelines/TextureTintPipeline'); var TextureTintPipeline = require('./pipelines/TextureTintPipeline');
/**
* @callback WebGLContextCallback
*
* @param {Phaser.Renderer.WebGL.WebGLRenderer} renderer - [description]
*/
/** /**
* @classdesc * @classdesc
* [description] * [description]
@ -115,7 +121,7 @@ var WebGLRenderer = new Class({
* [description] * [description]
* *
* @name Phaser.Renderer.WebGL.WebGLRenderer#lostContextCallbacks * @name Phaser.Renderer.WebGL.WebGLRenderer#lostContextCallbacks
* @type {function[]} * @type {WebGLContextCallback[]}
* @since 3.0.0 * @since 3.0.0
*/ */
this.lostContextCallbacks = []; this.lostContextCallbacks = [];
@ -124,7 +130,7 @@ var WebGLRenderer = new Class({
* [description] * [description]
* *
* @name Phaser.Renderer.WebGL.WebGLRenderer#restoredContextCallbacks * @name Phaser.Renderer.WebGL.WebGLRenderer#restoredContextCallbacks
* @type {function[]} * @type {WebGLContextCallback[]}
* @since 3.0.0 * @since 3.0.0
*/ */
this.restoredContextCallbacks = []; this.restoredContextCallbacks = [];
@ -384,7 +390,7 @@ var WebGLRenderer = new Class({
var canvas = this.canvas; var canvas = this.canvas;
var clearColor = config.backgroundColor; var clearColor = config.backgroundColor;
var gl = canvas.getContext('webgl', config.contextCreation) || canvas.getContext('experimental-webgl', config.contextCreation); var gl = canvas.getContext('webgl', config.contextCreation) || canvas.getContext('experimental-webgl', config.contextCreation);
if (!gl) if (!gl)
{ {
this.contextLost = true; this.contextLost = true;
@ -431,10 +437,10 @@ var WebGLRenderer = new Class({
this.addPipeline('FlatTintPipeline', new FlatTintPipeline({ game: this.game, renderer: this })); this.addPipeline('FlatTintPipeline', new FlatTintPipeline({ game: this.game, renderer: this }));
this.addPipeline('BitmapMaskPipeline', new BitmapMaskPipeline({ game: this.game, renderer: this })); this.addPipeline('BitmapMaskPipeline', new BitmapMaskPipeline({ game: this.game, renderer: this }));
this.addPipeline('Light2D', new ForwardDiffuseLightPipeline({ game: this.game, renderer: this })); this.addPipeline('Light2D', new ForwardDiffuseLightPipeline({ game: this.game, renderer: this }));
this.setBlendMode(CONST.BlendModes.NORMAL); this.setBlendMode(CONST.BlendModes.NORMAL);
this.resize(this.width, this.height); this.resize(this.width, this.height);
return this; return this;
}, },
@ -457,7 +463,7 @@ var WebGLRenderer = new Class({
this.width = Math.floor(width * resolution); this.width = Math.floor(width * resolution);
this.height = Math.floor(height * resolution); this.height = Math.floor(height * resolution);
this.canvas.width = this.width; this.canvas.width = this.width;
this.canvas.height = this.height; this.canvas.height = this.height;
@ -484,7 +490,7 @@ var WebGLRenderer = new Class({
* @method Phaser.Renderer.WebGL.WebGLRenderer#onContextRestored * @method Phaser.Renderer.WebGL.WebGLRenderer#onContextRestored
* @since 3.0.0 * @since 3.0.0
* *
* @param {function} callback - [description] * @param {WebGLContextCallback} callback - [description]
* @param {object} target - [description] * @param {object} target - [description]
* *
* @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description]
@ -502,7 +508,7 @@ var WebGLRenderer = new Class({
* @method Phaser.Renderer.WebGL.WebGLRenderer#onContextLost * @method Phaser.Renderer.WebGL.WebGLRenderer#onContextLost
* @since 3.0.0 * @since 3.0.0
* *
* @param {function} callback - [description] * @param {WebGLContextCallback} callback - [description]
* @param {object} target - [description] * @param {object} target - [description]
* *
* @return {Phaser.Renderer.WebGL.WebGLRenderer} [description] * @return {Phaser.Renderer.WebGL.WebGLRenderer} [description]
@ -713,7 +719,7 @@ var WebGLRenderer = new Class({
scissorStack[stackIndex + 1] = currentScissor[1]; scissorStack[stackIndex + 1] = currentScissor[1];
scissorStack[stackIndex + 2] = currentScissor[2]; scissorStack[stackIndex + 2] = currentScissor[2];
scissorStack[stackIndex + 3] = currentScissor[3]; scissorStack[stackIndex + 3] = currentScissor[3];
this.currentScissorIdx += 4; this.currentScissorIdx += 4;
this.setScissor(x, y, w, h); this.setScissor(x, y, w, h);
@ -732,7 +738,7 @@ var WebGLRenderer = new Class({
{ {
var scissorStack = this.scissorStack; var scissorStack = this.scissorStack;
var stackIndex = this.currentScissorIdx - 4; var stackIndex = this.currentScissorIdx - 4;
var x = scissorStack[stackIndex + 0]; var x = scissorStack[stackIndex + 0];
var y = scissorStack[stackIndex + 1]; var y = scissorStack[stackIndex + 1];
var w = scissorStack[stackIndex + 2]; var w = scissorStack[stackIndex + 2];
@ -740,7 +746,7 @@ var WebGLRenderer = new Class({
this.currentScissorIdx = stackIndex; this.currentScissorIdx = stackIndex;
this.setScissor(x, y, w, h); this.setScissor(x, y, w, h);
return this; return this;
}, },
@ -1002,7 +1008,7 @@ var WebGLRenderer = new Class({
if (indexBuffer !== this.currentIndexBuffer) if (indexBuffer !== this.currentIndexBuffer)
{ {
this.flush(); this.flush();
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer); gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer);
this.currentIndexBuffer = indexBuffer; this.currentIndexBuffer = indexBuffer;
@ -1089,7 +1095,7 @@ var WebGLRenderer = new Class({
pma = (pma === undefined || pma === null) ? true : pma; pma = (pma === undefined || pma === null) ? true : pma;
this.setTexture2D(texture, 0); this.setTexture2D(texture, 0);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, minFilter); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, minFilter);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, magFilter); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, magFilter);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, wrapS); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, wrapS);
@ -1356,7 +1362,7 @@ var WebGLRenderer = new Class({
var ch = Math.floor(camera.height * resolution); var ch = Math.floor(camera.height * resolution);
this.pushScissor(cx, cy, cw, ch); this.pushScissor(cx, cy, cw, ch);
if (camera.backgroundColor.alphaGL > 0) if (camera.backgroundColor.alphaGL > 0)
{ {
var color = camera.backgroundColor; var color = camera.backgroundColor;
@ -1533,7 +1539,7 @@ var WebGLRenderer = new Class({
* @method Phaser.Renderer.WebGL.WebGLRenderer#snapshot * @method Phaser.Renderer.WebGL.WebGLRenderer#snapshot
* @since 3.0.0 * @since 3.0.0
* *
* @param {function} callback - [description] * @param {SnapshotCallback} callback - [description]
* @param {string} type - [description] * @param {string} type - [description]
* @param {float} encoderOptions - [description] * @param {float} encoderOptions - [description]
* *
@ -1894,7 +1900,7 @@ var WebGLRenderer = new Class({
{ {
this.getExtension('WEBGL_lose_context').loseContext(); this.getExtension('WEBGL_lose_context').loseContext();
} }
delete this.gl; delete this.gl;
delete this.game; delete this.game;

View file

@ -7,6 +7,15 @@ var Class = require('../utils/Class');
var EventEmitter = require('eventemitter3'); var EventEmitter = require('eventemitter3');
var NOOP = require('../utils/NOOP'); 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 * @classdesc
* The sound manager is responsible for playing back audio via Web Audio API or HTML Audio tag as fallback. * 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 * @private
* @since 3.0.0 * @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. * @param {object} [scope] - Callback context.
*/ */
forEachActiveSound: function (callbackfn, scope) forEachActiveSound: function (callback, scope)
{ {
var _this = this; var _this = this;
this.sounds.forEach(function (sound, index) this.sounds.forEach(function (sound, index)
{ {
if (!sound.pendingRemove) 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'); 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 * @classdesc
* [description] * [description]
@ -737,7 +744,7 @@ var List = new Class({
* @method Phaser.Structs.List#each * @method Phaser.Structs.List#each
* @since 3.0.0 * @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 {object} [thisArg] - Value to use as `this` when executing callback.
* @param {...*} [arguments] - Additional arguments that will be passed to the callback, after the child. * @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'); var Class = require('../utils/Class');
/**
* @callback EachMapCallback
*
* @param {string} key - [description]
* @param {any} entry - [description]
*
* @return {?boolean} [description]
*/
/** /**
* @classdesc * @classdesc
* The keys of a Map can be arbitrary values. * The keys of a Map can be arbitrary values.
@ -32,7 +41,7 @@ var Map = new Class({
* [description] * [description]
* *
* @name Phaser.Structs.Map#entries * @name Phaser.Structs.Map#entries
* @type {object} * @type {Object.<string, any>}
* @default {} * @default {}
* @since 3.0.0 * @since 3.0.0
*/ */
@ -237,7 +246,7 @@ var Map = new Class({
* @method Phaser.Structs.Map#each * @method Phaser.Structs.Map#each
* @since 3.0.0 * @since 3.0.0
* *
* @param {function} callback - [description] * @param {EachMapCallback} callback - [description]
* *
* @return {Phaser.Structs.Map} This Map object. * @return {Phaser.Structs.Map} This Map object.
*/ */

View file

@ -6,6 +6,15 @@
var Class = require('../utils/Class'); var Class = require('../utils/Class');
/**
* @callback EachSetCallback
*
* @param {any} entry - [description]
* @param {number} index - [description]
*
* @return {?boolean} [description]
*/
/** /**
* @classdesc * @classdesc
* A Set is a collection of unique elements. * A Set is a collection of unique elements.
@ -148,7 +157,7 @@ var Set = new Class({
* @method Phaser.Structs.Set#each * @method Phaser.Structs.Set#each
* @since 3.0.0 * @since 3.0.0
* *
* @param {function} callback - [description] * @param {EachSetCallback} callback - [description]
* @param {object} callbackScope - [description] * @param {object} callbackScope - [description]
* *
* @return {Phaser.Structs.Set} This Set object. * @return {Phaser.Structs.Set} This Set object.
@ -189,7 +198,7 @@ var Set = new Class({
* @method Phaser.Structs.Set#iterate * @method Phaser.Structs.Set#iterate
* @since 3.0.0 * @since 3.0.0
* *
* @param {function} callback - [description] * @param {EachSetCallback} callback - [description]
* @param {object} callbackScope - [description] * @param {object} callbackScope - [description]
* *
* @return {Phaser.Structs.Set} This Set object. * @return {Phaser.Structs.Set} This Set object.

View file

@ -13,6 +13,13 @@ var GetValue = require('../utils/object/GetValue');
var Parser = require('./parsers'); var Parser = require('./parsers');
var Texture = require('./Texture'); 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 * @classdesc
* Textures are managed by the global TextureManager. This is a singleton class that is * 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 () image.onload = function ()
{ {
var texture = _this.create(key, image); var texture = _this.create(key, image);
Parser.Image(texture, 0); Parser.Image(texture, 0);
_this.emit('onload', key, texture); _this.emit('onload', key, texture);
@ -187,7 +194,7 @@ var TextureManager = new Class({
addImage: function (key, source, dataSource) addImage: function (key, source, dataSource)
{ {
var texture = this.create(key, source); var texture = this.create(key, source);
Parser.Image(texture, 0); Parser.Image(texture, 0);
if (dataSource) if (dataSource)
@ -262,7 +269,7 @@ var TextureManager = new Class({
addCanvas: function (key, source) addCanvas: function (key, source)
{ {
var texture = this.create(key, source); var texture = this.create(key, source);
Parser.Canvas(texture, 0); Parser.Canvas(texture, 0);
return texture; return texture;
@ -386,7 +393,7 @@ var TextureManager = new Class({
/** /**
* Adds a Sprite Sheet to this Texture Manager. * 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 * 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. * 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. * 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 * 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. * same size and cannot be trimmed or rotated.
* *
@ -738,7 +745,7 @@ var TextureManager = new Class({
* @method Phaser.Textures.TextureManager#each * @method Phaser.Textures.TextureManager#each
* @since 3.0.0 * @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 {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. * @param {...*} [arguments] - Additional arguments that will be passed to the callback, after the child.
*/ */