From 20155c6541dca14536ddd977feebb91de35aa9c0 Mon Sep 17 00:00:00 2001 From: Jare Guo Date: Fri, 19 May 2017 10:55:56 +0800 Subject: [PATCH] fix api about event type --- cocos2d/core/CCDirector.js | 18 +++++++++--------- cocos2d/core/CCNode.js | 19 +++++++++++-------- cocos2d/core/components/CCAnimation.js | 9 ++++++--- cocos2d/core/components/CCButton.js | 2 +- cocos2d/core/components/CCEditBox.js | 8 ++++---- cocos2d/core/components/CCPageView.js | 2 +- cocos2d/core/components/CCScrollView.js | 22 +++++++++++----------- cocos2d/core/components/CCSlider.js | 2 +- cocos2d/core/components/CCToggle.js | 2 +- cocos2d/core/components/CCVideoPlayer.js | 14 +++++++------- cocos2d/core/components/CCWebView.js | 6 +++--- cocos2d/core/event/event-target.js | 10 ++++++++-- cocos2d/core/utils/base-node.js | 2 +- index.js | 10 +++------- 14 files changed, 67 insertions(+), 59 deletions(-) diff --git a/cocos2d/core/CCDirector.js b/cocos2d/core/CCDirector.js index d47c76f7eb..b6074256f2 100644 --- a/cocos2d/core/CCDirector.js +++ b/cocos2d/core/CCDirector.js @@ -1239,7 +1239,7 @@ cc.js.addon(cc.Director.prototype, EventTarget.prototype); * !#en The event projection changed of cc.Director. * !#zh cc.Director 投影变化的事件。 * @event cc.Director.EVENT_PROJECTION_CHANGED - * @param {Event} event + * @param {Event.EventCustom} event * @example * cc.director.on(cc.Director.EVENT_PROJECTION_CHANGED, function(event) { * cc.log("Projection changed."); @@ -1251,7 +1251,7 @@ cc.Director.EVENT_PROJECTION_CHANGED = "director_projection_changed"; * !#en The event which will be triggered before loading a new scene. * !#zh 加载新场景之前所触发的事件。 * @event cc.Director.EVENT_BEFORE_SCENE_LOADING - * @param {Event} event + * @param {Event.EventCustom} event * @param {Vec2} event.detail - The loading scene name */ cc.Director.EVENT_BEFORE_SCENE_LOADING = "director_before_scene_loading"; @@ -1260,7 +1260,7 @@ cc.Director.EVENT_BEFORE_SCENE_LOADING = "director_before_scene_loading"; * !#en The event which will be triggered before launching a new scene. * !#zh 运行新场景之前所触发的事件。 * @event cc.Director.EVENT_BEFORE_SCENE_LAUNCH - * @param {Event} event + * @param {Event.EventCustom} event * @param {Vec2} event.detail - New scene which will be launched */ cc.Director.EVENT_BEFORE_SCENE_LAUNCH = "director_before_scene_launch"; @@ -1269,7 +1269,7 @@ cc.Director.EVENT_BEFORE_SCENE_LAUNCH = "director_before_scene_launch"; * !#en The event which will be triggered after launching a new scene. * !#zh 运行新场景之后所触发的事件。 * @event cc.Director.EVENT_AFTER_SCENE_LAUNCH - * @param {Event} event + * @param {Event.EventCustom} event * @param {Vec2} event.detail - New scene which is launched */ cc.Director.EVENT_AFTER_SCENE_LAUNCH = "director_after_scene_launch"; @@ -1278,7 +1278,7 @@ cc.Director.EVENT_AFTER_SCENE_LAUNCH = "director_after_scene_launch"; * !#en The event which will be triggered at the beginning of every frame. * !#zh 每个帧的开始时所触发的事件。 * @event cc.Director.EVENT_BEFORE_UPDATE - * @param {Event} event + * @param {Event.EventCustom} event */ cc.Director.EVENT_BEFORE_UPDATE = "director_before_update"; @@ -1286,7 +1286,7 @@ cc.Director.EVENT_BEFORE_UPDATE = "director_before_update"; * !#en The event which will be triggered after engine and components update logic. * !#zh 将在引擎和组件 “update” 逻辑之后所触发的事件。 * @event cc.Director.EVENT_AFTER_UPDATE - * @param {Event} event + * @param {Event.EventCustom} event */ cc.Director.EVENT_AFTER_UPDATE = "director_after_update"; @@ -1294,7 +1294,7 @@ cc.Director.EVENT_AFTER_UPDATE = "director_after_update"; * !#en The event which will be triggered before visiting the rendering scene graph. * !#zh 访问渲染场景树之前所触发的事件。 * @event cc.Director.EVENT_BEFORE_VISIT - * @param {Event} event + * @param {Event.EventCustom} event */ cc.Director.EVENT_BEFORE_VISIT = "director_before_visit"; @@ -1304,7 +1304,7 @@ cc.Director.EVENT_BEFORE_VISIT = "director_before_visit"; * the render queue is ready but not rendered at this point. * !#zh 访问渲染场景图之后所触发的事件,渲染队列已准备就绪,但在这一时刻还没有呈现在画布上。 * @event cc.Director.EVENT_AFTER_VISIT - * @param {Event} event + * @param {Event.EventCustom} event */ cc.Director.EVENT_AFTER_VISIT = "director_after_visit"; @@ -1312,7 +1312,7 @@ cc.Director.EVENT_AFTER_VISIT = "director_after_visit"; * !#en The event which will be triggered after the rendering process. * !#zh 渲染过程之后所触发的事件。 * @event cc.Director.EVENT_AFTER_DRAW - * @param {Event} event + * @param {Event.EventCustom} event */ cc.Director.EVENT_AFTER_DRAW = "director_after_draw"; diff --git a/cocos2d/core/CCNode.js b/cocos2d/core/CCNode.js index caeb9dd1ed..da3804d92a 100644 --- a/cocos2d/core/CCNode.js +++ b/cocos2d/core/CCNode.js @@ -1112,13 +1112,16 @@ var Node = cc.Class({ * See {{#crossLink "Node/position-changed:event"}}Node Events{{/crossLink}} for all builtin events. * @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 {Event} callback.param event + * @param {Event} callback.event event * @param {Object} [target] - The target to invoke the callback, can be null * @param {Boolean} [useCapture=false] - When set to true, the capture argument prevents callback * from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. * When false, callback will NOT be invoked when event's eventPhase attribute value is CAPTURING_PHASE. * Either way, callback will be invoked when event's eventPhase attribute value is AT_TARGET. * @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, useCapture?: boolean): (event: Event.EventCustom) => void + * on(type: string, callback: (event: T) => void, target?: any, useCapture?: boolean): (event: T) => void * @example * this.node.on(cc.Node.EventType.TOUCH_START, this.memberFunction, this); // if "this" is component and the "memberFunction" declared in CCClass. * node.on(cc.Node.EventType.TOUCH_START, callback, this.node); @@ -2506,35 +2509,35 @@ if (CC_JSB) { /** * @event position-changed - * @param {Event} event + * @param {Event.EventCustom} event * @param {Vec2} event.detail - The old position, but this parameter is only available in editor! */ /** * @event size-changed - * @param {Event} event + * @param {Event.EventCustom} event * @param {Size} event.detail - The old size, but this parameter is only available in editor! */ /** * @event anchor-changed - * @param {Event} event + * @param {Event.EventCustom} event */ /** * @event child-added - * @param {Event} event + * @param {Event.EventCustom} event * @param {Node} event.detail - child */ /** * @event child-removed - * @param {Event} event + * @param {Event.EventCustom} event * @param {Node} event.detail - child */ /** * @event child-reorder - * @param {Event} event + * @param {Event.EventCustom} event */ /** * @event group-changed - * @param {Event} event + * @param {Event.EventCustom} event */ /** diff --git a/cocos2d/core/components/CCAnimation.js b/cocos2d/core/components/CCAnimation.js index 9c59fc25ad..e70f645625 100644 --- a/cocos2d/core/components/CCAnimation.js +++ b/cocos2d/core/components/CCAnimation.js @@ -507,7 +507,7 @@ var Animation = cc.Class({ * @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 {Event} callback.param event + * @param {Event} callback.event event * @param {Object} [target] - The target to invoke the callback, can be null * @param {Boolean} [useCapture=false] - When set to true, the capture argument prevents callback * from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. @@ -515,6 +515,9 @@ var Animation = cc.Class({ * Either way, callback will be invoked when event's eventPhase attribute value is AT_TARGET. * * @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, useCapture?: boolean): (event: Event.EventCustom) => void + * on(type: string, callback: (event: T) => void, target?: any, useCapture?: boolean): (event: T) => void * @example * onPlay: function (event) { * var state = event.detail; // state instanceof cc.AnimationState @@ -522,7 +525,7 @@ var Animation = cc.Class({ * } * * // register event to all animation - * animation.on('', 'play', this.onPlay, this); + * animation.on('play', this.onPlay, this); */ on: function (type, callback, target, useCapture) { this._init(); @@ -561,7 +564,7 @@ var Animation = cc.Class({ * * @example * // unregister event to all animation - * animation.off('', 'play', this.onPlay, this); + * animation.off('play', this.onPlay, this); */ off: function (type, callback, target, useCapture) { this._init(); diff --git a/cocos2d/core/components/CCButton.js b/cocos2d/core/components/CCButton.js index 56c9a3335a..a4f053c847 100644 --- a/cocos2d/core/components/CCButton.js +++ b/cocos2d/core/components/CCButton.js @@ -664,6 +664,6 @@ cc.Button = module.exports = Button; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event click - * @param {Event} event + * @param {Event.EventCustom} event * @param {Button} event.detail - The Button component. */ diff --git a/cocos2d/core/components/CCEditBox.js b/cocos2d/core/components/CCEditBox.js index 7db3dbcb4b..a0d1a98c84 100644 --- a/cocos2d/core/components/CCEditBox.js +++ b/cocos2d/core/components/CCEditBox.js @@ -593,7 +593,7 @@ cc.EditBox = module.exports = EditBox; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event editing-did-began - * @param {Event} event + * @param {Event.EventCustom} event * @param {EditBox} event.detail - The EditBox component. */ @@ -603,7 +603,7 @@ cc.EditBox = module.exports = EditBox; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event editing-did-ended - * @param {Event} event + * @param {Event.EventCustom} event * @param {EditBox} event.detail - The EditBox component. */ @@ -613,7 +613,7 @@ cc.EditBox = module.exports = EditBox; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event text-changed - * @param {Event} event + * @param {Event.EventCustom} event * @param {EditBox} event.detail - The EditBox component. */ @@ -623,6 +623,6 @@ cc.EditBox = module.exports = EditBox; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event editing-return - * @param {Event} event + * @param {Event.EventCustom} event * @param {EditBox} event.detail - The EditBox component. */ diff --git a/cocos2d/core/components/CCPageView.js b/cocos2d/core/components/CCPageView.js index 47907474d7..76b11641ce 100644 --- a/cocos2d/core/components/CCPageView.js +++ b/cocos2d/core/components/CCPageView.js @@ -605,6 +605,6 @@ cc.PageView = module.exports = PageView; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event page-turning - * @param {Event} event + * @param {Event.EventCustom} event * @param {PageView} event.detail - The PageView component. */ diff --git a/cocos2d/core/components/CCScrollView.js b/cocos2d/core/components/CCScrollView.js index c516bf574b..2b058ec992 100644 --- a/cocos2d/core/components/CCScrollView.js +++ b/cocos2d/core/components/CCScrollView.js @@ -1510,7 +1510,7 @@ cc.ScrollView = module.exports = ScrollView; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event scroll-to-top - * @param {Event} event + * @param {Event.EventCustom} event * @param {ScrollView} event.detail - The ScrollView component. */ @@ -1520,7 +1520,7 @@ cc.ScrollView = module.exports = ScrollView; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event scroll-to-bottom - * @param {Event} event + * @param {Event.EventCustom} event * @param {ScrollView} event.detail - The ScrollView component. */ @@ -1530,7 +1530,7 @@ cc.ScrollView = module.exports = ScrollView; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event scroll-to-left - * @param {Event} event + * @param {Event.EventCustom} event * @param {ScrollView} event.detail - The ScrollView component. */ @@ -1540,7 +1540,7 @@ cc.ScrollView = module.exports = ScrollView; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event scroll-to-right - * @param {Event} event + * @param {Event.EventCustom} event * @param {ScrollView} event.detail - The ScrollView component. */ @@ -1550,7 +1550,7 @@ cc.ScrollView = module.exports = ScrollView; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event scrolling - * @param {Event} event + * @param {Event.EventCustom} event * @param {ScrollView} event.detail - The ScrollView component. */ @@ -1560,7 +1560,7 @@ cc.ScrollView = module.exports = ScrollView; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event bounce-bottom - * @param {Event} event + * @param {Event.EventCustom} event * @param {ScrollView} event.detail - The ScrollView component. */ @@ -1570,7 +1570,7 @@ cc.ScrollView = module.exports = ScrollView; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event bounce-top - * @param {Event} event + * @param {Event.EventCustom} event * @param {ScrollView} event.detail - The ScrollView component. */ @@ -1580,7 +1580,7 @@ cc.ScrollView = module.exports = ScrollView; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event bounce-left - * @param {Event} event + * @param {Event.EventCustom} event * @param {ScrollView} event.detail - The ScrollView component. */ @@ -1590,7 +1590,7 @@ cc.ScrollView = module.exports = ScrollView; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event bounce-right - * @param {Event} event + * @param {Event.EventCustom} event * @param {ScrollView} event.detail - The ScrollView component. */ @@ -1600,7 +1600,7 @@ cc.ScrollView = module.exports = ScrollView; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event scroll-ended - * @param {Event} event + * @param {Event.EventCustom} event * @param {ScrollView} event.detail - The ScrollView component. */ @@ -1610,6 +1610,6 @@ cc.ScrollView = module.exports = ScrollView; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event touch-up - * @param {Event} event + * @param {Event.EventCustom} event * @param {ScrollView} event.detail - The ScrollView component. */ diff --git a/cocos2d/core/components/CCSlider.js b/cocos2d/core/components/CCSlider.js index 9922090461..293b73035a 100644 --- a/cocos2d/core/components/CCSlider.js +++ b/cocos2d/core/components/CCSlider.js @@ -226,6 +226,6 @@ cc.Slider = module.exports = Slider; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event slider - * @param {Event} event + * @param {Event.EventCustom} event * @param {Slider} event.detail - The slider component. */ diff --git a/cocos2d/core/components/CCToggle.js b/cocos2d/core/components/CCToggle.js index a791d9d546..a65605ab18 100644 --- a/cocos2d/core/components/CCToggle.js +++ b/cocos2d/core/components/CCToggle.js @@ -224,6 +224,6 @@ cc.Toggle = module.exports = Toggle; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event toggle - * @param {Event} event + * @param {Event.EventCustom} event * @param {Toggle} event.detail - The Toggle component. */ diff --git a/cocos2d/core/components/CCVideoPlayer.js b/cocos2d/core/components/CCVideoPlayer.js index 6089ec6b74..2997f0c8a6 100644 --- a/cocos2d/core/components/CCVideoPlayer.js +++ b/cocos2d/core/components/CCVideoPlayer.js @@ -376,7 +376,7 @@ cc.VideoPlayer = module.exports = VideoPlayer; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event ready-to-play - * @param {Event} event + * @param {Event.EventCustom} event * @param {VideoPlayer} event.detail - The VideoPlayer component. */ @@ -386,7 +386,7 @@ cc.VideoPlayer = module.exports = VideoPlayer; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event meta-loaded - * @param {Event} event + * @param {Event.EventCustom} event * @param {VideoPlayer} event.detail - The VideoPlayer component. */ @@ -396,7 +396,7 @@ cc.VideoPlayer = module.exports = VideoPlayer; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event clicked - * @param {Event} event + * @param {Event.EventCustom} event * @param {VideoPlayer} event.detail - The VideoPlayer component. */ @@ -407,7 +407,7 @@ cc.VideoPlayer = module.exports = VideoPlayer; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event playing - * @param {Event} event + * @param {Event.EventCustom} event * @param {VideoPlayer} event.detail - The VideoPlayer component. */ @@ -417,7 +417,7 @@ cc.VideoPlayer = module.exports = VideoPlayer; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event paused - * @param {Event} event + * @param {Event.EventCustom} event * @param {VideoPlayer} event.detail - The VideoPlayer component. */ @@ -427,7 +427,7 @@ cc.VideoPlayer = module.exports = VideoPlayer; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event stopped - * @param {Event} event + * @param {Event.EventCustom} event * @param {VideoPlayer} event.detail - The VideoPlayer component. */ @@ -437,6 +437,6 @@ cc.VideoPlayer = module.exports = VideoPlayer; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event completed - * @param {Event} event + * @param {Event.EventCustom} event * @param {VideoPlayer} event.detail - The VideoPlayer component. */ diff --git a/cocos2d/core/components/CCWebView.js b/cocos2d/core/components/CCWebView.js index f963c2d7fe..369d460399 100644 --- a/cocos2d/core/components/CCWebView.js +++ b/cocos2d/core/components/CCWebView.js @@ -162,7 +162,7 @@ cc.WebView = module.exports = WebView; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event loaded - * @param {Event} event + * @param {Event.EventCustom} event * @param {WebView} event.detail - The WebView component. */ @@ -172,7 +172,7 @@ cc.WebView = module.exports = WebView; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event loading - * @param {Event} event + * @param {Event.EventCustom} event * @param {WebView} event.detail - The WebView component. */ @@ -182,6 +182,6 @@ cc.WebView = module.exports = WebView; * !#zh * 注意:此事件是从该组件所属的 Node 上面派发出来的,需要用 node.on 来监听。 * @event error - * @param {Event} event + * @param {Event.EventCustom} event * @param {WebView} event.detail - The WebView component. */ diff --git a/cocos2d/core/event/event-target.js b/cocos2d/core/event/event-target.js index 085b44a069..f9820f43be 100644 --- a/cocos2d/core/event/event-target.js +++ b/cocos2d/core/event/event-target.js @@ -161,13 +161,16 @@ proto.hasEventListener = function (type, checkCapture) { * @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 {Event} callback.param event + * @param {Event} callback.event event * @param {Object} [target] - The target to invoke the callback, can be null * @param {Boolean} [useCapture=false] - When set to true, the capture argument prevents callback * from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. * When false, callback will NOT be invoked when event's eventPhase attribute value is CAPTURING_PHASE. * Either way, callback will be invoked when event's eventPhase attribute value is AT_TARGET. * @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, useCapture?: boolean): (event: Event.EventCustom) => void + * on(type: string, callback: (event: T) => void, target?: any, useCapture?: boolean): (event: T) => void * @example * node.on(cc.Node.EventType.TOUCH_END, function (event) { * cc.log("this is callback"); @@ -273,12 +276,15 @@ proto.targetOff = function (target) { * @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 {Event} callback.param event + * @param {Event} callback.event event * @param {Object} [target] - The target to invoke the callback, can be null * @param {Boolean} [useCapture=false] - When set to true, the capture argument prevents callback * from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. * When false, callback will NOT be invoked when event's eventPhase attribute value is CAPTURING_PHASE. * Either way, callback will be invoked when event's eventPhase attribute value is AT_TARGET. + * @typescript + * once(type: string, callback: (event: Event.EventCustom) => void, target?: any, useCapture?: boolean): (event: Event.EventCustom) => void + * once(type: string, callback: (event: T) => void, target?: any, useCapture?: boolean): (event: T) => void * @example * node.once(cc.Node.EventType.TOUCH_END, function (event) { * cc.log("this is callback"); diff --git a/cocos2d/core/utils/base-node.js b/cocos2d/core/utils/base-node.js index f4f516d2c9..1338885551 100644 --- a/cocos2d/core/utils/base-node.js +++ b/cocos2d/core/utils/base-node.js @@ -1260,7 +1260,7 @@ if (CC_DEV) { * !#zh * 注意:此节点激活时,此事件仅从最顶部的节点发出。 * @event active-in-hierarchy-changed - * @param {Event} event + * @param {Event.EventCustom} event */ cc._BaseNode = module.exports = BaseNode; diff --git a/index.js b/index.js index 1af520a245..bcd531e264 100644 --- a/index.js +++ b/index.js @@ -43,7 +43,7 @@ Function( require('./predefine'); -// load cocos2D engine code +// load Cocos2d engine code var isMainProcess = CC_EDITOR && Editor.isMainProcess; if (!isMainProcess) { @@ -58,12 +58,8 @@ else { require('./extends'); if (CC_EDITOR) { - /** - * In editor, in addition to the modules defined in cc scope, you can also access to the internal modules by using _require. - * @method _require - * @example - * var isDomNode = cc._require('./cocos2d/core/platform/utils').isDomNode; - */ + // In editor, in addition to the modules defined in cc scope, you can also access to the internal modules by using _require. + // var isDomNode = cc._require('./cocos2d/core/platform/utils').isDomNode; cc._require = require; /* * Checks if the extension is loaded.