On 08/16/2011 02:34 PM, franck34 wrote:
> var req = new qx.io.request.Xhr(url,'POST');
To do everything in the constructor is ok if you intend to throw each
UtilXhr instance away after its instantiation.
Notice i'm noob in OO too so ... what do you mean ? need i have to add
something in my main code ?
var myRequest = new tradingactive.xhr(.....);
myRequest.destroy()
or something like that ?
No, no, I actually just wanted to point to the fact that you cannot use
a qx.io.request.Xhr object twice (AFAIK); it has to be fresh for each
request. So using the same Xhr object again, even for the same URL with
same parameters, wouldn't work.
> },this);
> req.send();
>
> }
> });
In general, I personally prefer constructors to be "declarative", just
configuring the new instance and not doing any serious actions. But
that's just my personal taste.
Please learn me to make a clean code ! can you show me a sample ?
It's not unclean what you are doing. I just don't like objects dashing
ahead by only creating them. When I create them I want them to do
nothing, just be ready. Among other things, this allows me to pass those
objects around, store them in data structures, etc., and then later
actually "fire" them.
So my take would be :
var myrequest = new new tradingactive.UtilXhr(.....);
myrequest.send(); // or something like that
But again this is due to personal taste, and you might prefer otherwise.
T.
------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model
configuration take the hassle out of deploying and managing Subversion and
the tools developers use with it. Learn more about uberSVN and get a free
download at: http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel