View Full Version : Tidying the code: LoadMask, is this a bad idea?

20 Oct 2011, 10:40 AM
Hi everyone,

I've seen this solution around:

var myMask = new Ext.LoadMask(Ext.getBody(), {msg:"Please wait..."});

and then:


As I am building an application that does a lot of waiting (whilst it deals with web services), I have the need to create specific masks for specific views, and sometimes specific situations within a view, therefore I didn't want a global variable.

I did this in my view:

this.loadMask = new Ext.LoadMask(Ext.getBody(), {msg:"Doing something..."});

So basically, what I do is replace the property loadMask that belongs to the panel object, taking benefit of the object itself, avoid dealing with global vars. Whenever I need to change the message I just change the property of the object.
Is this a bad idea? Can it cause any trouble in the future? Could you give me some advice regarding this subject?

Thank you all.