Skip to content

Instantly share code, notes, and snippets.

@olizilla
Last active December 11, 2015 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olizilla/4665211 to your computer and use it in GitHub Desktop.
Save olizilla/4665211 to your computer and use it in GitHub Desktop.
A proposal for an ExtJS 3 component initialisation pattern.
Ext.namespace('foo');
foo.UpdatePositionDialog = Ext.extend(Ext.Window, {
/**
* @param {Object} config Instance configuration options
*/
constructor:function (config) {
// Merge the incoming config with the defaults. Externally provided properties take precedence.
config = Ext.apply({
cls:'UpdatePositionDialog',
width:600,
height:'auto'
},
config || {}); // Alas Ext is still a bit rubbish so we have to guard against a null config
foo.UpdatePositionDialog.superclass.constructor.call(this, config);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment