mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 20:53:39 +00:00
Add more callbacks
This commit is contained in:
parent
1e8311e1ab
commit
fa13b597e3
8 changed files with 74 additions and 19 deletions
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue