Search code examples
sencha-touchprototyping

Is there a better way to default in Touch?


I prototype in touch, but Ext.create tells me to go to heck ( as does Ext.define ) So i'm back to doing

ViewPort= function(c){
    var default={
        fullscreen:true,
        items:[]
    };Ext.apply(default,c);config = default;

    ViewPort.superclass.constructor.call(this,config);
};
Ext.extend( ViewPort, Ext.Panel);

And then manipulating the config with functions and stuff. Is there a better way to do what the "default" variable does for me?


Solution

  • This is shorter,and much neater

    ViewPort= function(config){
        config=Ext.apply({},config,{
            fullscreen:true
            items:[],
        });
    
        ViewPort.superclass.constructor.call(this,config);
    };
    Ext.extend( ViewPort, Ext.Panel);