mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 07:42:38 +08:00
Fix docs (#3172)
This commit is contained in:
@@ -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<T extends Function>(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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -51,7 +51,7 @@ var idGenerater = new (require('../platform/id-generater'))('Tex');
|
||||
|
||||
* @class Texture2D
|
||||
* @uses EventTarget
|
||||
* @extends RawAsset
|
||||
* @extends Asset
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -287,4 +287,4 @@ var MotionStreak = cc.Class({
|
||||
}
|
||||
});
|
||||
|
||||
cc.MotionStreak = module.exports = MotionStreak;
|
||||
cc.MotionStreak = module.exports = MotionStreak;
|
||||
@@ -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<T>(type: string, callback: (event: T) => void, target?: any): (event: T) => void
|
||||
* on<T extends Function>(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);
|
||||
*/
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user