Operating environment

    Due to historical reasons, cc is an identifier reserved for Cocos Creator. Its behavior is equivalent to having defined an object named cc at the top of any module. Therefore, developers should not use cc as the name of any global object. Example:

    1. /* const cc = {}; // Every Cocos Creator script is equivalent to an implicit definition here */
    2. import * as modules from 'cc'; // Error: Namespace import name cc is reserved by Cocos Creator
    3. console.log(cc.x); // Error: The global object name cc is reserved by Cocos Creator
    4. function f () {
    5. console.log(cc.x); // Correct: cc can be used as the name of a local object
    6. const o = { cc: 0 };
    7. console.log(o.cc); // Correct: cc can be used as a property name
    8. }