From 4f734a806d1fd7c4073fb064fddc961384fe67af Mon Sep 17 00:00:00 2001
From: ColinCollins <35832931+ColinCollins@users.noreply.github.com>
Date: Fri, 24 Aug 2018 13:41:14 +0800
Subject: [PATCH] modify the note for periodic function (#3140)
---
cocos2d/core/components/CCComponent.js | 42 +++++++++++++++++---------
1 file changed, 28 insertions(+), 14 deletions(-)
diff --git a/cocos2d/core/components/CCComponent.js b/cocos2d/core/components/CCComponent.js
index bbe0c3b528..9775a43a2e 100644
--- a/cocos2d/core/components/CCComponent.js
+++ b/cocos2d/core/components/CCComponent.js
@@ -217,8 +217,10 @@ var Component = cc.Class({
// We provide Pre methods, which are called right before something happens, and Post methods which are called right after something happens.
/**
- * !#en Update is called every frame, if the Component is enabled.
- * !#zh 如果该组件启用,则每帧调用 update。
+ * !#en Update is called every frame, if the Component is enabled.
+ * This is a lifecycle method. It may not be implemented in the super class. You can only call its super class method inside it. It should not be called manually elsewhere.
+ * !#zh 如果该组件启用,则每帧调用 update。
+ * 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
* @method update
* @param {Number} dt - the delta time in seconds it took to complete the last frame
* @protected
@@ -226,8 +228,10 @@ var Component = cc.Class({
update: null,
/**
- * !#en LateUpdate is called every frame, if the Component is enabled.
- * !#zh 如果该组件启用,则每帧调用 LateUpdate。
+ * !#en LateUpdate is called every frame, if the Component is enabled.
+ * This is a lifecycle method. It may not be implemented in the super class. You can only call its super class method inside it. It should not be called manually elsewhere.
+ * !#zh 如果该组件启用,则每帧调用 LateUpdate。
+ * 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
* @method lateUpdate
* @protected
*/
@@ -247,9 +251,11 @@ var Component = cc.Class({
/**
* !#en
* When attaching to an active node or its node first activated.
- * onLoad is always called before any start functions, this allows you to order initialization of scripts.
+ * onLoad is always called before any start functions, this allows you to order initialization of scripts.
+ * This is a lifecycle method. It may not be implemented in the super class. You can only call its super class method inside it. It should not be called manually elsewhere.
* !#zh
- * 当附加到一个激活的节点上或者其节点第一次激活时候调用。onLoad 总是会在任何 start 方法调用前执行,这能用于安排脚本的初始化顺序。
+ * 当附加到一个激活的节点上或者其节点第一次激活时候调用。onLoad 总是会在任何 start 方法调用前执行,这能用于安排脚本的初始化顺序。
+ * 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
* @method onLoad
* @protected
*/
@@ -258,33 +264,41 @@ var Component = cc.Class({
/**
* !#en
* Called before all scripts' update if the Component is enabled the first time.
- * Usually used to initialize some logic which need to be called after all components' `onload` methods called.
+ * Usually used to initialize some logic which need to be called after all components' `onload` methods called.
+ * This is a lifecycle method. It may not be implemented in the super class. You can only call its super class method inside it. It should not be called manually elsewhere.
* !#zh
- * 如果该组件第一次启用,则在所有组件的 update 之前调用。通常用于需要在所有组件的 onLoad 初始化完毕后执行的逻辑。
+ * 如果该组件第一次启用,则在所有组件的 update 之前调用。通常用于需要在所有组件的 onLoad 初始化完毕后执行的逻辑。
+ * 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
* @method start
* @protected
*/
start: null,
/**
- * !#en Called when this component becomes enabled and its node is active.
- * !#zh 当该组件被启用,并且它的节点也激活时。
+ * !#en Called when this component becomes enabled and its node is active.
+ * This is a lifecycle method. It may not be implemented in the super class. You can only call its super class method inside it. It should not be called manually elsewhere.
+ * !#zh 当该组件被启用,并且它的节点也激活时。
+ * 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
* @method onEnable
* @protected
*/
onEnable: null,
/**
- * !#en Called when this component becomes disabled or its node becomes inactive.
- * !#zh 当该组件被禁用或节点变为无效时调用。
+ * !#en Called when this component becomes disabled or its node becomes inactive.
+ * This is a lifecycle method. It may not be implemented in the super class. You can only call its super class method inside it. It should not be called manually elsewhere.
+ * !#zh 当该组件被禁用或节点变为无效时调用。
+ * 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
* @method onDisable
* @protected
*/
onDisable: null,
/**
- * !#en Called when this component will be destroyed.
- * !#zh 当该组件被销毁时调用
+ * !#en Called when this component will be destroyed.
+ * This is a lifecycle method. It may not be implemented in the super class. You can only call its super class method inside it. It should not be called manually elsewhere.
+ * !#zh 当该组件被销毁时调用
+ * 该方法为生命周期方法,父类未必会有实现。并且你只能在该方法内部调用父类的实现,不可在其它地方直接调用该方法。
* @method onDestroy
* @protected
*/