Created
April 16, 2013 22:59
-
-
Save moduscreate/5400389 to your computer and use it in GitHub Desktop.
Ext.Base.prototype.callSuper documentation
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
/** | |
* This method is used by an override to call the superclass method but bypass any | |
* overridden method. This is often done to "patch" a method that contains a bug | |
* but for whatever reason cannot be fixed directly. | |
* | |
* Consider: | |
* | |
* Ext.define('Ext.some.Class', { | |
* method: function () { | |
* console.log('Good'); | |
* } | |
* }); | |
* | |
* Ext.define('Ext.some.DerivedClass', { | |
* extend : 'Ext.some.Class', // <-- This line is currently missing from the current docs | |
* | |
* method: function () { | |
* console.log('Bad'); | |
* | |
* // ... logic but with a bug ... | |
* | |
* this.callParent(); | |
* } | |
* }); | |
* | |
* To patch the bug in `DerivedClass.method`, the typical solution is to create an | |
* override: | |
* | |
* Ext.define('App.patches.DerivedClass', { // "patches" is written as "paches" in the current docs | |
* override: 'Ext.some.DerivedClass', | |
* | |
* method: function () { | |
* console.log('Fixed'); | |
* | |
* // ... logic but with bug fixed ... | |
* | |
* this.callSuper(); | |
* } | |
* }); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment