PDA

View Full Version : How to manage Unused Dom and Objects



tomalex0
30 Nov 2010, 5:42 AM
Hi,

Just need some guidance while approaching a Project Using Sencha.

Basically the App will have Many Panels and SubPanels.

For examples I have two Main Panels A and B

where A have 10 items (Panel) and B have 12 items.

While some panel layouts are shared by both A and B
so i made it as a function


var subpanFunc = function (id,title){
if(Ext.getCmp(id)){
return Ext.getCmp(id);
}
var subpan = new Ext.Panel({
id:id,
title:'title
items:[
// this may be a list with users
]
});
return subpan;
}


So if i make two calls like


var sub1,sub2;

sub1= subpanFunc('sub1','sub1');
sub2= subpanFunc('sub2','sub2');




mainpanelA.setActiveItem(sub1);
mainpanelB.setActiveItem(sub2);


I have two instance of same panel and sub1 with be item of A and sub2 that of B;

while im not accessing B , i will destroy all items of B to free the Dom.
But the variables to which i have assigned the panels will be still there.
ie sub2 will be having all the objects.

Then i will have to manualy set
sub2 = {}


So what i'm trying to ask is

will those objects make App Slow ?
Is there a better way to approach this ?

Hope someone could help me with this.

evant
30 Nov 2010, 2:59 PM
Don't prematurely optimize. I don't see you having much of a problem.

tomalex0
1 Dec 2010, 1:13 AM
Thanks for the reply

The scenario i faced was while working with Kitchen Sink. As it contained many panels and subpanel, orientation in Iphone became bit slow(it takes time to adjust whole Layout). At the same time there are many unused panels also. So i destroyed the unused elements.

Is it supposed to make the app bit fast?