diff --git a/cocos2d/core/CCGame.js b/cocos2d/core/CCGame.js index 1fd3bf95aa..3198b03478 100644 --- a/cocos2d/core/CCGame.js +++ b/cocos2d/core/CCGame.js @@ -390,6 +390,27 @@ var game = { eventTargetOn: EventTarget.prototype.on, eventTargetOnce: EventTarget.prototype.once, + /** + * !#en + * Register an callback of a specific event type on the game object. + * This type of event should be triggered via `emit`. + * !#zh + * 注册 game 的特定事件类型回调。这种类型的事件应该被 `emit` 触发。 + * + * @method on + * @param {String} type - A string representing the event type to listen for. + * @param {Function} callback - The callback that will be invoked when the event is dispatched. + * The callback is ignored if it is a duplicate (the callbacks are unique). + * @param {any} [callback.arg1] arg1 + * @param {any} [callback.arg2] arg2 + * @param {any} [callback.arg3] arg3 + * @param {any} [callback.arg4] arg4 + * @param {any} [callback.arg5] arg5 + * @param {Object} [target] - The target (this object) to invoke the callback, can be null + * @return {Function} - Just returns the incoming callback so you can save the anonymous function easier. + * @typescript + * on(type: string, callback: T, target?: any, useCapture?: boolean): T + */ on (type, callback, target) { // Make sure EVENT_ENGINE_INITED callbacks to be invoked if (this._prepared && type === this.EVENT_ENGINE_INITED) { @@ -399,6 +420,24 @@ var game = { this.eventTargetOn(type, callback, target); } }, + /** + * !#en + * Register an callback of a specific event type on the game object, + * the callback will remove itself after the first time it is triggered. + * !#zh + * 注册 game 的特定事件类型回调,回调会在第一时间被触发后删除自身。 + * + * @method once + * @param {String} type - A string representing the event type to listen for. + * @param {Function} callback - The callback that will be invoked when the event is dispatched. + * The callback is ignored if it is a duplicate (the callbacks are unique). + * @param {any} [callback.arg1] arg1 + * @param {any} [callback.arg2] arg2 + * @param {any} [callback.arg3] arg3 + * @param {any} [callback.arg4] arg4 + * @param {any} [callback.arg5] arg5 + * @param {Object} [target] - The target (this object) to invoke the callback, can be null + */ once (type, callback, target) { // Make sure EVENT_ENGINE_INITED callbacks to be invoked if (this._prepared && type === this.EVENT_ENGINE_INITED) { diff --git a/cocos2d/core/CCNode.js b/cocos2d/core/CCNode.js index 4813c4a0b4..1f1a0a94e2 100644 --- a/cocos2d/core/CCNode.js +++ b/cocos2d/core/CCNode.js @@ -2246,8 +2246,8 @@ var Node = cc.Class({ /* * Transforms position from world space to local space. * @method _invTransformPoint - * @param {vmath.Vec3} out - * @param {vmath.Vec3} vec3 + * @param {Vec3} out + * @param {Vec3} vec3 */ _invTransformPoint (out, pos) { if (this._parent) { @@ -2324,8 +2324,8 @@ var Node = cc.Class({ * Calculate and return world rotation * This is not a public API yet, its usage could be updated * @method getWorldRot - * @param {vmath.Quat} out - * @return {vmath.Quat} + * @param {Quat} out + * @return {Quat} */ getWorldRot (out) { math.quat.copy(out, this._quat); @@ -2341,7 +2341,7 @@ var Node = cc.Class({ * Set world rotation with quaternion * This is not a public API yet, its usage could be updated * @method setWorldRot - * @param {vmath.Quat} rot + * @param {Quat} rot */ setWorldRot (quat) { if (this._parent) { diff --git a/cocos2d/core/assets/CCRenderTexture.js b/cocos2d/core/assets/CCRenderTexture.js index 856bce29bf..1a3d100871 100644 --- a/cocos2d/core/assets/CCRenderTexture.js +++ b/cocos2d/core/assets/CCRenderTexture.js @@ -22,7 +22,8 @@ let RenderTexture = cc.Class({ * !#zh * 初始化 render texture * @param {Number} [width] - * @param {Number} [height] + * @param {Number} [height] + * @param {Number} [depthStencilFormat] * @method initWithSize */ initWithSize (width, height, depthStencilFormat) { diff --git a/cocos2d/core/assets/CCTexture2D.js b/cocos2d/core/assets/CCTexture2D.js index f6aaad029d..39d83bcb1e 100644 --- a/cocos2d/core/assets/CCTexture2D.js +++ b/cocos2d/core/assets/CCTexture2D.js @@ -51,7 +51,7 @@ var idGenerater = new (require('../platform/id-generater'))('Tex'); * @class Texture2D * @uses EventTarget - * @extends RawAsset + * @extends Asset */ /** diff --git a/cocos2d/core/components/CCMotionStreak.js b/cocos2d/core/components/CCMotionStreak.js index b577013a2b..1c16d944e3 100644 --- a/cocos2d/core/components/CCMotionStreak.js +++ b/cocos2d/core/components/CCMotionStreak.js @@ -287,4 +287,4 @@ var MotionStreak = cc.Class({ } }); -cc.MotionStreak = module.exports = MotionStreak; +cc.MotionStreak = module.exports = MotionStreak; \ No newline at end of file diff --git a/cocos2d/core/event/event-target.js b/cocos2d/core/event/event-target.js index 2f0a39f850..bdf2c40e72 100644 --- a/cocos2d/core/event/event-target.js +++ b/cocos2d/core/event/event-target.js @@ -89,10 +89,9 @@ var proto = EventTarget.prototype; * @param {Object} [target] - The target (this object) to invoke the callback, can be null * @return {Function} - Just returns the incoming callback so you can save the anonymous function easier. * @typescript - * on(type: string, callback: (event: Event.EventCustom) => void, target?: any): (event: Event.EventCustom) => void - * on(type: string, callback: (event: T) => void, target?: any): (event: T) => void + * on(type: string, callback: T, target?: any, useCapture?: boolean): T * @example - * eventTarget.on('fire', function (event) { + * eventTarget.on('fire', function () { * cc.log("fire in the hole"); * }, node); */ @@ -124,7 +123,7 @@ proto.on = function (type, callback, target) { * @param {Object} [target] - The target (this object) to invoke the callback, if it's not given, only callback without target will be removed * @example * // register fire eventListener - * var callback = eventTarget.on('fire', function (event) { + * var callback = eventTarget.on('fire', function () { * cc.log("fire in the hole"); * }, target); * // remove fire event listener @@ -176,7 +175,7 @@ proto.targetOff = proto.removeAll; * @param {any} [callback.arg5] arg5 * @param {Object} [target] - The target (this object) to invoke the callback, can be null * @example - * eventTarget.once('fire', function (event) { + * eventTarget.once('fire', function () { * cc.log("this is the callback and will be invoked only once"); * }, node); */ diff --git a/cocos2d/core/load-pipeline/CCLoader.js b/cocos2d/core/load-pipeline/CCLoader.js index 6849ec8e69..50dfaca8c8 100644 --- a/cocos2d/core/load-pipeline/CCLoader.js +++ b/cocos2d/core/load-pipeline/CCLoader.js @@ -102,6 +102,14 @@ function CCLoader () { */ this.assetLoader = assetLoader; + /** + * The md5 pipe in cc.loader's pipeline, it could be absent if the project isn't build with md5 option. + * It's used to modify the url to the real downloadable url with md5 suffix. + * @property md5Pipe + * @type {Object} + */ + this.md5Pipe = null; + /** * The downloader in cc.loader's pipeline, it's by default the second pipe. * It's used to download files with several handlers: pure text, image, script, audio, font, uuid. diff --git a/cocos2d/tilemap/CCTiledMap.js b/cocos2d/tilemap/CCTiledMap.js index 601d1e8598..af8794d87b 100644 --- a/cocos2d/tilemap/CCTiledMap.js +++ b/cocos2d/tilemap/CCTiledMap.js @@ -361,7 +361,7 @@ let TiledMap = cc.Class({ /** * !#en Return All layers array. * !#zh 返回包含所有 layer 的数组。 - * @method allLayers + * @method getLayers * @returns {TiledLayer[]} * @example * let layers = titledMap.allLayers();