X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/3789b528d8dd8aad4558e38e22d775bcab1cbd36..6746dc89c47ed01b165cc1152533605f97eb8e8d:/docs/output/Ext.Class.js diff --git a/docs/output/Ext.Class.js b/docs/output/Ext.Class.js index f7174781..00b523f0 100644 --- a/docs/output/Ext.Class.js +++ b/docs/output/Ext.Class.js @@ -1,195 +1,421 @@ Ext.data.JsonP.Ext_Class({ - "tagname": "class", - "name": "Ext.Class", - "doc": "
Handles class creation throughout the whole framework. Note that most of the time Ext.define should\nbe used instead, since it's a higher level wrapper that aliases to Ext.ClassManager.create\nto enable namespacing and dynamic dependency resolution.
\n\nExt.define(className, properties);\n
\n\nin which properties
is an object represent a collection of properties that apply to the class. See\nExt.ClassManager.create for more detailed instructions.
Ext.define('Person', {\n name: 'Unknown',\n\n constructor: function(name) {\n if (name) {\n this.name = name;\n }\n\n return this;\n },\n\n eat: function(foodType) {\n alert(\"I'm eating: \" + foodType);\n\n return this;\n }\n});\n\nvar aaron = new Person(\"Aaron\");\naaron.eat(\"Sandwich\"); // alert(\"I'm eating: Sandwich\");\n
\n\nExt.Class has a powerful set of extensible pre-processors which takes care of\neverything related to class creation, including but not limited to inheritance, mixins, configuration, statics, etc.
\n\nExt.define('Developer', {\n extend: 'Person',\n\n constructor: function(name, isGeek) {\n this.isGeek = isGeek;\n\n // Apply a method from the parent class' prototype\n this.callParent([name]);\n\n return this;\n\n },\n\n code: function(language) {\n alert(\"I'm coding in: \" + language);\n\n this.eat(\"Bugs\");\n\n return this;\n }\n});\n\nvar jacky = new Developer(\"Jacky\", true);\njacky.code(\"JavaScript\"); // alert(\"I'm coding in: JavaScript\");\n // alert(\"I'm eating: Bugs\");\n
\n\nSee Ext.Base.callParent for more details on calling superclass' methods
\n\nExt.define('CanPlayGuitar', {\n playGuitar: function() {\n alert(\"F#...G...D...A\");\n }\n});\n\nExt.define('CanComposeSongs', {\n composeSongs: function() { ... }\n});\n\nExt.define('CanSing', {\n sing: function() {\n alert(\"I'm on the highway to hell...\")\n }\n});\n\nExt.define('Musician', {\n extend: 'Person',\n\n mixins: {\n canPlayGuitar: 'CanPlayGuitar',\n canComposeSongs: 'CanComposeSongs',\n canSing: 'CanSing'\n }\n})\n\nExt.define('CoolPerson', {\n extend: 'Person',\n\n mixins: {\n canPlayGuitar: 'CanPlayGuitar',\n canSing: 'CanSing'\n },\n\n sing: function() {\n alert(\"Ahem....\");\n\n this.mixins.canSing.sing.call(this);\n\n alert(\"[Playing guitar at the same time...]\");\n\n this.playGuitar();\n }\n});\n\nvar me = new CoolPerson(\"Jacky\");\n\nme.sing(); // alert(\"Ahem...\");\n // alert(\"I'm on the highway to hell...\");\n // alert(\"[Playing guitar at the same time...]\");\n // alert(\"F#...G...D...A\");\n
\n\nExt.define('SmartPhone', {\n config: {\n hasTouchScreen: false,\n operatingSystem: 'Other',\n price: 500\n },\n\n isExpensive: false,\n\n constructor: function(config) {\n this.initConfig(config);\n\n return this;\n },\n\n applyPrice: function(price) {\n this.isExpensive = (price > 500);\n\n return price;\n },\n\n applyOperatingSystem: function(operatingSystem) {\n if (!(/^(iOS|Android|BlackBerry)$/i).test(operatingSystem)) {\n return 'Other';\n }\n\n return operatingSystem;\n }\n});\n\nvar iPhone = new SmartPhone({\n hasTouchScreen: true,\n operatingSystem: 'iOS'\n});\n\niPhone.getPrice(); // 500;\niPhone.getOperatingSystem(); // 'iOS'\niPhone.getHasTouchScreen(); // true;\niPhone.hasTouchScreen(); // true\n\niPhone.isExpensive; // false;\niPhone.setPrice(600);\niPhone.getPrice(); // 600\niPhone.isExpensive; // true;\n\niPhone.setOperatingSystem('AlienOS');\niPhone.getOperatingSystem(); // 'Other'\n
\n\nExt.define('Computer', {\n statics: {\n factory: function(brand) {\n // 'this' in static methods refer to the class itself\n return new this(brand);\n }\n },\n\n constructor: function() { ... }\n});\n\nvar dellComputer = Computer.factory('Dell');\n
\n\nAlso see Ext.Base.statics and Ext.Base.self for more details on accessing\nstatic properties within class methods
\n", - "extends": null, - "mixins": [ - - ], - "alternateClassNames": [ + "allMixins": [ ], - "xtype": null, - "author": "Jacky NguyenRetrieve the array stack of default pre-processors
\n", - "params": [ - - ], - "return": { - "type": "Function", - "doc": "defaultPreprocessors
\n" + "members": { + "cfg": [ + { + "type": "[String]", + "deprecated": null, + "alias": null, + "protected": false, + "tagname": "cfg", + "href": "ClassManager.html#Ext-Class-cfg-alias", + "shortDoc": "List of short aliases for class names. ...", + "static": false, + "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/ClassManager.js", + "private": false, + "name": "alias", + "owner": "Ext.Class", + "doc": "List of short aliases for class names. Most useful for defining xtypes for widgets:
\n\nExt.define('MyApp.CoolPanel', {\n extend: 'Ext.panel.Panel',\n alias: ['widget.coolpanel'],\n title: 'Yeah!'\n});\n\n// Using Ext.create\nExt.widget('widget.coolpanel');\n// Using the shorthand for widgets and in xtypes\nExt.widget('panel', {\n items: [\n {xtype: 'coolpanel', html: 'Foo'},\n {xtype: 'coolpanel', html: 'Bar'}\n ]\n});\n
\n",
+ "linenr": 850,
+ "html_filename": "ClassManager.html"
},
- "private": false,
- "static": false,
- "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/class/Class.js",
- "linenr": 349,
- "html_filename": "Class.html",
- "href": "Class.html#Ext-Class-method-getDefaultPreprocessors",
- "shortDoc": "Retrieve the array stack of default pre-processors
\n" - }, - { - "tagname": "method", - "name": "getPreprocessor", - "member": "Ext.Class", - "doc": "Retrieve a pre-processor callback function by its name, which has been registered before
\n", - "params": [ - { - "type": "String", - "name": "name", - "doc": "\n", - "optional": false - } - ], - "return": { - "type": "Function", - "doc": "preprocessor
\n" + { + "type": "String/[String]", + "deprecated": null, + "alias": null, + "protected": false, + "tagname": "cfg", + "href": "ClassManager.html#Ext-Class-cfg-alternateClassName", + "shortDoc": "Defines alternate names for this class. ...", + "static": false, + "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/ClassManager.js", + "private": false, + "name": "alternateClassName", + "owner": "Ext.Class", + "doc": "Defines alternate names for this class. For example:
\n\nExt.define('Developer', {\n alternateClassName: ['Coder', 'Hacker'],\n code: function(msg) {\n alert('Typing... ' + msg);\n }\n});\n\nvar joe = Ext.create('Developer');\njoe.code('stackoverflow');\n\nvar rms = Ext.create('Hacker');\nrms.code('hack hack');\n
\n",
+ "linenr": 927,
+ "html_filename": "ClassManager.html"
},
- "private": false,
- "static": false,
- "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/class/Class.js",
- "linenr": 335,
- "html_filename": "Class.html",
- "href": "Class.html#Ext-Class-method-getPreprocessor",
- "shortDoc": "Retrieve a pre-processor callback function by its name, which has been registered before
\n" - }, - { - "tagname": "method", - "name": "registerPreprocessor", - "member": "Ext.Class", - "doc": "Register a new pre-processor to be used during the class creation process registerPreprocessor
\n", - "params": [ - { - "type": "String", - "name": "name", - "doc": "The pre-processor's name
\n", - "optional": false + { + "type": "Object", + "deprecated": null, + "alias": null, + "protected": false, + "tagname": "cfg", + "href": "Class.html#Ext-Class-cfg-config", + "shortDoc": "List of configuration options with their default values, for which automatically\naccessor methods are generated. ...", + "static": false, + "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Class.js", + "private": false, + "name": "config", + "owner": "Ext.Class", + "doc": "List of configuration options with their default values, for which automatically\naccessor methods are generated. For example:
\n\nExt.define('SmartPhone', {\n config: {\n hasTouchScreen: false,\n operatingSystem: 'Other',\n price: 500\n },\n constructor: function(cfg) {\n this.initConfig(cfg);\n }\n});\n\nvar iPhone = new SmartPhone({\n hasTouchScreen: true,\n operatingSystem: 'iOS'\n});\n\niPhone.getPrice(); // 500;\niPhone.getOperatingSystem(); // 'iOS'\niPhone.getHasTouchScreen(); // true;\niPhone.hasTouchScreen(); // true\n
\n",
+ "linenr": 580,
+ "html_filename": "Class.html"
+ },
+ {
+ "type": "String",
+ "deprecated": null,
+ "alias": null,
+ "protected": false,
+ "tagname": "cfg",
+ "href": "Class.html#Ext-Class-cfg-extend",
+ "shortDoc": "The parent class that this class extends. ...",
+ "static": false,
+ "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Class.js",
+ "private": false,
+ "name": "extend",
+ "owner": "Ext.Class",
+ "doc": "The parent class that this class extends. For example:
\n\nExt.define('Person', {\n say: function(text) { alert(text); }\n});\n\nExt.define('Developer', {\n extend: 'Person',\n say: function(text) { this.callParent([\"print \"+text]); }\n});\n
\n",
+ "linenr": 420,
+ "html_filename": "Class.html"
+ },
+ {
+ "type": "Object",
+ "deprecated": null,
+ "alias": null,
+ "protected": false,
+ "tagname": "cfg",
+ "href": "Class.html#Ext-Class-cfg-inheritableStatics",
+ "shortDoc": "List of inheritable static methods for this class. ...",
+ "static": false,
+ "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Class.js",
+ "private": false,
+ "name": "inheritableStatics",
+ "owner": "Ext.Class",
+ "doc": "List of inheritable static methods for this class.\nOtherwise just like statics but subclasses inherit these methods.
\n", + "linenr": 529, + "html_filename": "Class.html" + }, + { + "type": "Object", + "deprecated": null, + "alias": null, + "protected": false, + "tagname": "cfg", + "href": "Class.html#Ext-Class-cfg-mixins", + "shortDoc": "List of classes to mix into this class. ...", + "static": false, + "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Class.js", + "private": false, + "name": "mixins", + "owner": "Ext.Class", + "doc": "List of classes to mix into this class. For example:
\n\nExt.define('CanSing', {\n sing: function() {\n alert(\"I'm on the highway to hell...\")\n }\n});\n\nExt.define('Musician', {\n extend: 'Person',\n\n mixins: {\n canSing: 'CanSing'\n }\n})\n
\n",
+ "linenr": 556,
+ "html_filename": "Class.html"
+ },
+ {
+ "type": "[String]",
+ "deprecated": null,
+ "alias": null,
+ "protected": false,
+ "tagname": "cfg",
+ "href": "Loader.html#Ext-Class-cfg-requires",
+ "shortDoc": "List of classes that have to be loaded before instanciating this class. ...",
+ "static": false,
+ "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Loader.js",
+ "private": false,
+ "name": "requires",
+ "owner": "Ext.Class",
+ "doc": "List of classes that have to be loaded before instanciating this class.\nFor example:
\n\nExt.define('Mother', {\n requires: ['Child'],\n giveBirth: function() {\n // we can be sure that child class is available.\n return new Child();\n }\n});\n
\n",
+ "linenr": 971,
+ "html_filename": "Loader.html"
+ },
+ {
+ "type": "Boolean",
+ "deprecated": null,
+ "alias": null,
+ "protected": false,
+ "tagname": "cfg",
+ "href": "ClassManager.html#Ext-Class-cfg-singleton",
+ "shortDoc": "When set to true, the class will be instanciated as singleton. ...",
+ "static": false,
+ "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/ClassManager.js",
+ "private": false,
+ "name": "singleton",
+ "owner": "Ext.Class",
+ "doc": "When set to true, the class will be instanciated as singleton. For example:
\n\nExt.define('Logger', {\n singleton: true,\n log: function(msg) {\n console.log(msg);\n }\n});\n\nLogger.log('Hello');\n
\n",
+ "linenr": 908,
+ "html_filename": "ClassManager.html"
+ },
+ {
+ "type": "Object",
+ "deprecated": null,
+ "alias": null,
+ "protected": false,
+ "tagname": "cfg",
+ "href": "Class.html#Ext-Class-cfg-statics",
+ "shortDoc": "List of static methods for this class. ...",
+ "static": false,
+ "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Class.js",
+ "private": false,
+ "name": "statics",
+ "owner": "Ext.Class",
+ "doc": "List of static methods for this class. For example:
\n\nExt.define('Computer', {\n statics: {\n factory: function(brand) {\n // 'this' in static methods refer to the class itself\n return new this(brand);\n }\n },\n\n constructor: function() { ... }\n});\n\nvar dellComputer = Computer.factory('Dell');\n
\n",
+ "linenr": 499,
+ "html_filename": "Class.html"
+ },
+ {
+ "type": "[String]",
+ "deprecated": null,
+ "alias": null,
+ "protected": false,
+ "tagname": "cfg",
+ "href": "Loader.html#Ext-Class-cfg-uses",
+ "shortDoc": "List of classes to load together with this class. ...",
+ "static": false,
+ "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Loader.js",
+ "private": false,
+ "name": "uses",
+ "owner": "Ext.Class",
+ "doc": "List of classes to load together with this class. These aren't neccessarily loaded before\nthis class is instanciated. For example:
\n\nExt.define('Mother', {\n uses: ['Child'],\n giveBirth: function() {\n // This code might, or might not work:\n // return new Child();\n\n // Instead use Ext.create() to load the class at the spot if not loaded already:\n return Ext.create('Child');\n }\n});\n
\n",
+ "linenr": 1132,
+ "html_filename": "Loader.html"
+ }
+ ],
+ "method": [
+ {
+ "deprecated": null,
+ "alias": null,
+ "href": "Class.html#Ext-Class-method-constructor",
+ "tagname": "method",
+ "protected": false,
+ "shortDoc": "Creates new class. ...",
+ "static": false,
+ "params": [
+ {
+ "type": "Object",
+ "optional": false,
+ "doc": "An object represent the properties of this class
\n", + "name": "classData" + }, + { + "type": "Function", + "optional": false, + "doc": "Optional, the callback function to be executed when this class is fully created.\nNote that the creation process can be asynchronous depending on the pre-processors used.
\n", + "name": "createdFn" + } + ], + "private": false, + "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Class.js", + "doc": "Creates new class.
\n", + "owner": "Ext.Class", + "name": "Class", + "html_filename": "Class.html", + "return": { + "type": "Ext.Base", + "doc": "The newly created class
\n" }, - { + "linenr": 207 + }, + { + "deprecated": null, + "alias": null, + "protected": false, + "tagname": "method", + "href": "Class.html#Ext-Class-method-getDefaultPreprocessors", + "shortDoc": "Retrieve the array stack of default pre-processors ...", + "static": false, + "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Class.js", + "private": false, + "params": [ + + ], + "name": "getDefaultPreprocessors", + "owner": "Ext.Class", + "doc": "Retrieve the array stack of default pre-processors
\n", + "linenr": 350, + "return": { "type": "Function", - "name": "fn", - "doc": "The callback function to be executed. Typical format:
\n\nfunction(cls, data, fn) {\n // Your code here\n\n // Execute this when the processing is finished.\n // Asynchronous processing is perfectly ok\n if (fn) {\n fn.call(this, cls, data);\n }\n});\n
\n\nPassed arguments for this function are:
\n\n{Function} cls
: The created class{Object} data
: The set of properties passed in Ext.Class constructor{Function} fn
: The callback function that must to be executed when this pre-processor finishes,\nregardless of whether the processing is synchronous or aynchronousdefaultPreprocessors
\n" }, - { - "type": "Object", - "name": "always", - "doc": "\n", - "optional": false - } - ], - "return": { - "type": "Ext.Class", - "doc": "this
\n" + "html_filename": "Class.html" }, - "private": false, - "static": false, - "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/class/Class.js", - "linenr": 298, - "html_filename": "Class.html", - "href": "Class.html#Ext-Class-method-registerPreprocessor", - "shortDoc": "Register a new pre-processor to be used during the class creation process registerPreprocessor
\n" - }, - { - "tagname": "method", - "name": "setDefaultPreprocessorPosition", - "member": "Ext.Class", - "doc": "Insert this pre-processor at a specific position in the stack, optionally relative to\nany existing pre-processor. For example:
\n\nExt.Class.registerPreprocessor('debug', function(cls, data, fn) {\n // Your code here\n\n if (fn) {\n fn.call(this, cls, data);\n }\n}).insertDefaultPreprocessor('debug', 'last');\n
\n",
- "params": [
- {
- "type": "String",
- "name": "name",
- "doc": "The pre-processor name. Note that it needs to be registered with\nregisterPreprocessor before this
\n", - "optional": false + { + "deprecated": null, + "alias": null, + "protected": false, + "tagname": "method", + "href": "Class.html#Ext-Class-method-getPreprocessor", + "shortDoc": "Retrieve a pre-processor callback function by its name, which has been registered before ...", + "static": false, + "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Class.js", + "private": false, + "params": [ + { + "type": "String", + "optional": false, + "doc": "\n", + "name": "name" + } + ], + "name": "getPreprocessor", + "owner": "Ext.Class", + "doc": "Retrieve a pre-processor callback function by its name, which has been registered before
\n", + "linenr": 336, + "return": { + "type": "Function", + "doc": "preprocessor
\n" }, - { - "type": "String", - "name": "offset", - "doc": "The insertion position. Four possible values are:\n'first', 'last', or: 'before', 'after' (relative to the name provided in the third argument)
\n", - "optional": false + "html_filename": "Class.html" + }, + { + "deprecated": null, + "alias": null, + "protected": false, + "tagname": "method", + "href": "Class.html#Ext-Class-method-registerPreprocessor", + "shortDoc": "Register a new pre-processor to be used during the class creation process registerPreprocessor ...", + "static": false, + "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Class.js", + "private": false, + "params": [ + { + "type": "String", + "optional": false, + "doc": "The pre-processor's name
\n", + "name": "name" + }, + { + "type": "Function", + "optional": false, + "doc": "The callback function to be executed. Typical format:
\n\nfunction(cls, data, fn) {\n // Your code here\n\n // Execute this when the processing is finished.\n // Asynchronous processing is perfectly ok\n if (fn) {\n fn.call(this, cls, data);\n }\n});\n
\n\nPassed arguments for this function are:
\n\n{Function} cls
: The created class{Object} data
: The set of properties passed in Ext.Class constructor{Function} fn
: The callback function that must to be executed when this pre-processor finishes,\nregardless of whether the processing is synchronous or aynchronousRegister a new pre-processor to be used during the class creation process registerPreprocessor
\n", + "linenr": 299, + "return": { + "type": "Ext.Class", + "doc": "this
\n" }, - { - "type": "String", - "name": "relativeName", - "doc": "\n", - "optional": false - } - ], - "return": { - "type": "Ext.Class", - "doc": "this
\n" + "html_filename": "Class.html" }, - "private": false, - "static": false, - "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/class/Class.js", - "linenr": 370, - "html_filename": "Class.html", - "href": "Class.html#Ext-Class-method-setDefaultPreprocessorPosition", - "shortDoc": "Insert this pre-processor at a specific position in the stack, optionally relative to\nany existing pre-processor. For..." - }, - { - "tagname": "method", - "name": "setDefaultPreprocessors", - "member": "Ext.Class", - "doc": "Set the default array stack of default pre-processors
\n", - "params": [ - { - "type": "Array", - "name": "preprocessors", - "doc": "\n", - "optional": false - } - ], - "return": { - "type": "Ext.Class", - "doc": "this
\n" + { + "deprecated": null, + "alias": null, + "protected": false, + "tagname": "method", + "href": "Class.html#Ext-Class-method-setDefaultPreprocessorPosition", + "shortDoc": "Insert this pre-processor at a specific position in the stack, optionally relative to\nany existing pre-processor. ...", + "static": false, + "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Class.js", + "private": false, + "params": [ + { + "type": "String", + "optional": false, + "doc": "The pre-processor name. Note that it needs to be registered with\nregisterPreprocessor before this
\n", + "name": "name" + }, + { + "type": "String", + "optional": false, + "doc": "The insertion position. Four possible values are:\n'first', 'last', or: 'before', 'after' (relative to the name provided in the third argument)
\n", + "name": "offset" + }, + { + "type": "String", + "optional": false, + "doc": "\n", + "name": "relativeName" + } + ], + "name": "setDefaultPreprocessorPosition", + "owner": "Ext.Class", + "doc": "Insert this pre-processor at a specific position in the stack, optionally relative to\nany existing pre-processor. For example:
\n\nExt.Class.registerPreprocessor('debug', function(cls, data, fn) {\n // Your code here\n\n if (fn) {\n fn.call(this, cls, data);\n }\n}).insertDefaultPreprocessor('debug', 'last');\n
\n",
+ "linenr": 371,
+ "return": {
+ "type": "Ext.Class",
+ "doc": "this
\n" + }, + "html_filename": "Class.html" }, - "private": false, - "static": false, - "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/class/Class.js", - "linenr": 358, - "html_filename": "Class.html", - "href": "Class.html#Ext-Class-method-setDefaultPreprocessors", - "shortDoc": "Set the default array stack of default pre-processors
\n" - } - ], - "property": [ + { + "deprecated": null, + "alias": null, + "protected": false, + "tagname": "method", + "href": "Class.html#Ext-Class-method-setDefaultPreprocessors", + "shortDoc": "Set the default array stack of default pre-processors ...", + "static": false, + "filename": "/mnt/ebs/nightly/git/SDK/platform/core/src/class/Class.js", + "private": false, + "params": [ + { + "type": "Array", + "optional": false, + "doc": "\n", + "name": "preprocessors" + } + ], + "name": "setDefaultPreprocessors", + "owner": "Ext.Class", + "doc": "Set the default array stack of default pre-processors
\n", + "linenr": 359, + "return": { + "type": "Ext.Class", + "doc": "this
\n" + }, + "html_filename": "Class.html" + } + ], + "property": [ - ], - "event": [ + ], + "cssVar": [ - ], - "filename": "/Users/nick/Projects/sencha/SDK/platform/core/src/class/Class.js", - "linenr": 1, - "html_filename": "Class.html", - "href": "Class.html#Ext-Class", - "cssVar": [ + ], + "cssMixin": [ - ], - "cssMixin": [ + ], + "event": [ - ], - "component": false, + ] + }, + "singleton": false, + "alias": null, "superclasses": [ ], + "protected": false, + "tagname": "class", + "mixins": [ + + ], + "href": "Class.html#Ext-Class", "subclasses": [ ], + "static": false, + "author": "Jacky NguyenHandles class creation throughout the whole framework. Note that most of the time Ext.define should\nbe used instead, since it's a higher level wrapper that aliases to Ext.ClassManager.create\nto enable namespacing and dynamic dependency resolution.
\n\nExt.define(className, properties);\n
\n\nin which properties
is an object represent a collection of properties that apply to the class. See\nExt.ClassManager.create for more detailed instructions.
Ext.define('Person', {\n name: 'Unknown',\n\n constructor: function(name) {\n if (name) {\n this.name = name;\n }\n\n return this;\n },\n\n eat: function(foodType) {\n alert(\"I'm eating: \" + foodType);\n\n return this;\n }\n});\n\nvar aaron = new Person(\"Aaron\");\naaron.eat(\"Sandwich\"); // alert(\"I'm eating: Sandwich\");\n
\n\nExt.Class has a powerful set of extensible pre-processors which takes care of\neverything related to class creation, including but not limited to inheritance, mixins, configuration, statics, etc.
\n\nExt.define('Developer', {\n extend: 'Person',\n\n constructor: function(name, isGeek) {\n this.isGeek = isGeek;\n\n // Apply a method from the parent class' prototype\n this.callParent([name]);\n\n return this;\n\n },\n\n code: function(language) {\n alert(\"I'm coding in: \" + language);\n\n this.eat(\"Bugs\");\n\n return this;\n }\n});\n\nvar jacky = new Developer(\"Jacky\", true);\njacky.code(\"JavaScript\"); // alert(\"I'm coding in: JavaScript\");\n // alert(\"I'm eating: Bugs\");\n
\n\nSee Ext.Base.callParent for more details on calling superclass' methods
\n\nExt.define('CanPlayGuitar', {\n playGuitar: function() {\n alert(\"F#...G...D...A\");\n }\n});\n\nExt.define('CanComposeSongs', {\n composeSongs: function() { ... }\n});\n\nExt.define('CanSing', {\n sing: function() {\n alert(\"I'm on the highway to hell...\")\n }\n});\n\nExt.define('Musician', {\n extend: 'Person',\n\n mixins: {\n canPlayGuitar: 'CanPlayGuitar',\n canComposeSongs: 'CanComposeSongs',\n canSing: 'CanSing'\n }\n})\n\nExt.define('CoolPerson', {\n extend: 'Person',\n\n mixins: {\n canPlayGuitar: 'CanPlayGuitar',\n canSing: 'CanSing'\n },\n\n sing: function() {\n alert(\"Ahem....\");\n\n this.mixins.canSing.sing.call(this);\n\n alert(\"[Playing guitar at the same time...]\");\n\n this.playGuitar();\n }\n});\n\nvar me = new CoolPerson(\"Jacky\");\n\nme.sing(); // alert(\"Ahem...\");\n // alert(\"I'm on the highway to hell...\");\n // alert(\"[Playing guitar at the same time...]\");\n // alert(\"F#...G...D...A\");\n
\n\nExt.define('SmartPhone', {\n config: {\n hasTouchScreen: false,\n operatingSystem: 'Other',\n price: 500\n },\n\n isExpensive: false,\n\n constructor: function(config) {\n this.initConfig(config);\n\n return this;\n },\n\n applyPrice: function(price) {\n this.isExpensive = (price > 500);\n\n return price;\n },\n\n applyOperatingSystem: function(operatingSystem) {\n if (!(/^(iOS|Android|BlackBerry)$/i).test(operatingSystem)) {\n return 'Other';\n }\n\n return operatingSystem;\n }\n});\n\nvar iPhone = new SmartPhone({\n hasTouchScreen: true,\n operatingSystem: 'iOS'\n});\n\niPhone.getPrice(); // 500;\niPhone.getOperatingSystem(); // 'iOS'\niPhone.getHasTouchScreen(); // true;\niPhone.hasTouchScreen(); // true\n\niPhone.isExpensive; // false;\niPhone.setPrice(600);\niPhone.getPrice(); // 600\niPhone.isExpensive; // true;\n\niPhone.setOperatingSystem('AlienOS');\niPhone.getOperatingSystem(); // 'Other'\n
\n\nExt.define('Computer', {\n statics: {\n factory: function(brand) {\n // 'this' in static methods refer to the class itself\n return new this(brand);\n }\n },\n\n constructor: function() { ... }\n});\n\nvar dellComputer = Computer.factory('Dell');\n
\n\nAlso see Ext.Base.statics and Ext.Base.self for more details on accessing\nstatic properties within class methods
\n", "mixedInto": [ ], - "allMixins": [ + "linenr": 1, + "xtypes": [ - ] + ], + "html_filename": "Class.html", + "extends": null }); \ No newline at end of file