From 1e8311e1ab102b627993f27a2cc958d0ae2af81e Mon Sep 17 00:00:00 2001 From: orblazer Date: Mon, 19 Mar 2018 22:43:48 +0100 Subject: [PATCH] Add callbacks on Dom and Data --- src/data/DataManager.js | 11 ++++++++++- src/dom/DOMContentLoaded.js | 6 +++++- src/dom/RequestAnimationFrame.js | 6 +++--- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/data/DataManager.js b/src/data/DataManager.js index 3187c7dc5..a8b68de39 100644 --- a/src/data/DataManager.js +++ b/src/data/DataManager.js @@ -6,6 +6,15 @@ 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 * 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 * @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 {...*} [arguments] - Additional arguments that will be passed to the callback, after the game object, key, and data. * diff --git a/src/dom/DOMContentLoaded.js b/src/dom/DOMContentLoaded.js index 12a3d1a0b..9cf51deb0 100644 --- a/src/dom/DOMContentLoaded.js +++ b/src/dom/DOMContentLoaded.js @@ -6,6 +6,10 @@ 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. * 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 * @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) { diff --git a/src/dom/RequestAnimationFrame.js b/src/dom/RequestAnimationFrame.js index 7309102d1..ae480881f 100644 --- a/src/dom/RequestAnimationFrame.js +++ b/src/dom/RequestAnimationFrame.js @@ -37,7 +37,7 @@ var RequestAnimationFrame = new Class({ * The callback to be invoked each step. * * @name Phaser.DOM.RequestAnimationFrame#callback - * @type {function} + * @type {FrameRequestCallback} * @since 3.0.0 */ 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. * * @name Phaser.DOM.RequestAnimationFrame#step - * @type {function} + * @type {FrameRequestCallback} * @since 3.0.0 */ this.step = function step (timestamp) @@ -134,7 +134,7 @@ var RequestAnimationFrame = new Class({ * @method Phaser.DOM.RequestAnimationFrame#start * @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? */ start: function (callback, forceSetTimeOut)