From d2dbd72f34172310df6611c7465395da18ab4e65 Mon Sep 17 00:00:00 2001 From: minggo Date: Fri, 30 Mar 2018 13:51:38 +0800 Subject: [PATCH] remove duplicate codes --- index.js | 102 ------------------------------------------------------- 1 file changed, 102 deletions(-) diff --git a/index.js b/index.js index a0871a3c5d..d78b1b3b4e 100644 --- a/index.js +++ b/index.js @@ -24,108 +24,6 @@ THE SOFTWARE. ****************************************************************************/ -// MACROS - -/** - * !#zh - * 这里是一些用来判断执行环境的宏,这些宏都是全局变量,直接访问即可。
- * 在项目构建时,这些宏将会被预处理并根据构建的平台剔除不需要的代码,例如 - * - * if (CC_DEBUG) { - * cc.log('debug'); - * } - * else { - * cc.log('release'); - * } - * - * 在构建后会只剩下 - * - * cc.log('release'); - * - * (好棒棒)
- *
- * 如需判断脚本是否运行于指定平台,可以用如下表达式: - * - * { - * "编辑器": CC_EDITOR, - * "编辑器 或 预览": CC_DEV, - * "编辑器 或 预览 或 构建调试": CC_DEBUG, - * "网页预览": CC_PREVIEW && !CC_JSB, - * "模拟器预览": CC_PREVIEW && CC_JSB, - * "构建调试": CC_BUILD && CC_DEBUG, - * "构建发行": CC_BUILD && !CC_DEBUG, - * } - * - * !#en - * Here are some of the macro used to determine the execution environment, these macros are global variables, can be accessed directly.
- * When the project is built, these macros will be preprocessed and discard unreachable code based on the built platform, for example: - * - * if (CC_DEBUG) { - * cc.log('debug'); - * } - * else { - * cc.log('release'); - * } - * - * After build will become: - * - * cc.log('release'); - * - *
- * To determine whether the script is running on the specified platform, you can use the following expression: - * - * { - * "editor": CC_EDITOR, - * "editor or preview": CC_DEV, - * "editor or preview or build in debug mode": CC_DEBUG, - * "web preview": CC_PREVIEW && !CC_JSB, - * "simulator preview": CC_PREVIEW && CC_JSB, - * "build in debug mode": CC_BUILD && CC_DEBUG, - * "build in release mode": CC_BUILD && !CC_DEBUG, - * } - * - * @module GLOBAL-MACROS - */ -/** - * @property {Boolean} CC_EDITOR - Running in the editor. - */ -/** - * @property {Boolean} CC_PREVIEW - Preview in browser or simulator. - */ -/** - * @property {Boolean} CC_DEV - Running in the editor or preview. - */ -/** - * @property {Boolean} CC_DEBUG - Running in the editor or preview, or build in debug mode. - */ -/** - * @property {Boolean} CC_BUILD - Running in published project. - */ -/** - * @property {Boolean} CC_JSB - Running in native platform (mobile app, desktop app, or simulator). - */ -/** - * @property {Boolean} CC_TEST - Running in the engine's unit test. - */ -/** - * @property {Boolean} CC_WECHATGAME - Running in the Wechat's mini game. - */ - -// window may be undefined when first load engine from editor -var _global = typeof window === 'undefined' ? global : window; -function defineMacro (name, defaultValue) { - // if "global_defs" not preprocessed by uglify, just declare them globally, - // this may happened in release version's preview page. - // (use evaled code to prevent mangle by uglify) - if (typeof _global[name] === 'undefined') { - _global[name] = defaultValue; - } -} -function defined (name) { - return typeof _global[name] === 'object'; -} - - // PREDEFINE /**