One of the basic founding design principles of MooTools is object reuse. As a rule of thumb, create a new object only when you need different functionality. You can use the same Request and Fx instances for example, over and over again.

var request = new Request();
request.post(...);
request.send(...);

var fx = new Fx.Morph('myelement');
fx.start({color: '#f00'});
//later
fx.start({height: 100, width: 200});

MooTools takes care of the initializing and cleaning everything that needs to be initialized and cleaned between calls to start / send / etc. So to answer your question, please re-use away! MooTools was literally designed to be used this way.

- Tom

On Oct 23, 2008, at 9:47 AM, gabriel munteanu wrote:


Hi all,
on viewing a page , a user on my website can make many ajax requests.
i create a new Request() object all the time , and then call its send method.
is it ok to reuse this object? or does it reuse xmlhttpreuqest object
in its implementation ?

thanks
jgabios

Reply via email to