4th addition to xwt.util: queue

Charles Goodwin <[email protected]> Thu, 06 Nov 2003 14:27:29 +0000
Newsgroups gmane.comp.java.xwt.widgets
Organization XWT Foundation
Message-ID <[email protected]>
*slaps head*  Dammit wrong list.

-------- Original Message --------
Subject: [core] 4th addition to xwt.util: queue
Date: Thu, 06 Nov 2003 14:22:48 +0000
From: Charles Goodwin <[email protected]>
Reply-To: [email protected]
Organization: XWT Foundation
To: [email protected]

I've added another (grossly incomplete) util template to the xwt.util
namespace, which is beginning to look quite useful.

It is xwt.util.queue which can be used to queue anonymous functions.

"Why would you want to queue anonymous functions?"

Well, supposed you wanted to make lots of RPC calls... lots and lots,
but you don't want to manage them.  Or supposing you want to start lots
of threads but not all at once.

It's basically a resource maintainer to help you prevent an XWT from
flooding itself with requests.

So you do:

var myqueue = xwt.util.queue..newQueue( c, t );
// c is the number of concurrent executions
// t is an optional timeout

myqueue.add( function() {
     xwt.thread = function {
         ...
     }
} );

Et voila, that is it.  It will get executed when it has reached the
front of the queue.

Now I just need to actually make template.xwt do the above. :)

- Charlie


_______________________________________________
core mailing list
[email protected]
http://lists.xwt.org/listinfo/core