Created
January 24, 2023 21:58
-
-
Save tobiu/dfa763d10c317af5e3d78680a3fb70f0 to your computer and use it in GitHub Desktop.
Neo.core.Base
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* The base class for (almost) all classes inside the Neo namespace | |
* Exceptions are e.g. core.IdGenerator, vdom.VNode | |
* @class Neo.core.Base | |
*/ | |
class Base { | |
/** | |
* The return value will get applied to the class constructor | |
* @returns {Object} staticConfig | |
* @static | |
* @tutorial 02_ClassSystem | |
*/ | |
static getStaticConfig() {return { | |
/** | |
* Set this one to false in case you don't want to stick | |
* to the "anti-pattern" to apply classes to the global Neo or App namespace | |
* @member {Boolean} registerToGlobalNs=true | |
* @protected | |
* @static | |
*/ | |
registerToGlobalNs: true | |
}} | |
/** | |
* The return value will get applied to each class instance | |
* @returns {Object} config | |
* @tutorial 02_ClassSystem | |
*/ | |
static getConfig() {return { | |
/** | |
* The class name which will get mapped into the Neo or app namespace | |
* @member {String} className='Neo.core.Base' | |
* @protected | |
*/ | |
className: 'Neo.core.Base', | |
/** | |
* The class shortcut-name to use for e.g. creating child components inside a JSON-format | |
* @member {String} ntype='base' | |
* @protected | |
*/ | |
ntype: 'base', | |
/** | |
* The unique component id | |
* @member {String|null} id_=null | |
*/ | |
id_: null, | |
/** | |
* Neo.create() will change this flag to true after the onConstructed() chain is done. | |
* @member {Boolean} isConstructed=false | |
* @protected | |
*/ | |
isConstructed: false, | |
/** | |
* Add mixins as an array of classNames, imported modules or a mixed version | |
* @member {String[]|Neo.core.Base[]|null} mixins=null | |
*/ | |
mixins: null, | |
/** | |
* You can create a new instance by passing an imported class (JS module default export) | |
* @member {Class} module=null | |
* @protected | |
*/ | |
module: null | |
}} | |
// ... | |
} | |
Neo.applyClassConfig(Base); | |
export default Base; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment