Yeah I know that Mike and that is exactly what I had to do. :-)

But just consider most timer concepts, if not all, that I have ever
worked with from RTOS systems or even Emulated RTOS systems all
started the process (event) as soon as it is called, which is your
intention as soon as the code point was reached with the interval
providing the frequency from that point on. :-)

So a welcomed plug-in should naturally consider the same basic idea.
In fact, one idea I had for a plug-in was going to be a simple jQuery
Helper library that will add basic ideas. This timer start idea was
one of them along with this other one I had in mind to add to jQuery:

- visual notification (wait.gif).

The idea is simple, no need to get extra plug-ins just to get  two
basic fundamental ideas in a AJAX concept.

Note: I can understand the idea of separation of layers; abstract vs
visual, standard consideration in protocol development.  But JS is
already expensive as it is, and this plug-ins can be big when all lump
together, so these two ideas -  event timer management options and a
basic visual loadnig notifcation, in my view should be part of th base
jQuery package.

Just my 1.5 pennies worth. :-)

---
HLS

On Aug 16, 4:32 am, "Michael Geary" <[EMAIL PROTECTED]> wrote:
> One of the nice things about JavaScript is that it can be so easy to write a
> general function for something like this.
>
> To make a version of setInterval that also calls the function immediately,
> all you need is:
>
>    function nowInterval( fn, time ) {
>       fn();
>       return setInterval( fn, time );
>    }
>
> And then your code would be:
>
>    $(function() {
>       nowInterval( function() {
>          $('#result').load('/someurl');
>       }, 10000 );  // repeat now and every 10 seconds
>    });
>
> -Mike
>
> > From: Pops
>
> > Blair,  this is a great idea.
>
> > I don't know if you considered this and maybe I did it wrong
> > myself since I'm still new to jQuery, but when I prepare a
> > time like so:
>
> >   $(function() {
> >      setInterval( function() {
> >      $('#result').load('/someurl');
> >      }, 10000 );  // repeat every 10 seconds
> >   });
>
> > What bugs me is that triggers it only the 10 seconds is
> > reached.  I would like for it to start the event immediately
> > and from that point
> > on, do the interval event.   In short, in the example above, the user
> > has to wait 10 seconds before anything happens.   To get around this I
> > had to call the url first:
>
> >   $('#result').load('/someurl');
> >   $(function() {
> >      setInterval( function() {
> >      $('#result').load('/someurl');
> >      }, 10000 );  // repeat every 10 seconds
> >   });
>
> > Something trivial of course, but a pain in the butt (a PITA
> > <g>) to have to "duplicate" a line, sort of anti-jQuery. :-)

Reply via email to