Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #40221

Re: Coord timed events

Subject Re: Coord timed events
Newsgroups comp.lang.javascript
References <h_KdnVLOH6-pAVf9nZ2dnUU7-efNnZ2d@westnet.com.au> <87eed1jo40.fsf@bsb.me.uk>
From Andrew Poulos <ap_prog@hotmail.com>
Date 2021-06-17 13:17 +1000
Message-ID <IsOdnRRCc5ZWI1f9nZ2dnUU7-WfNnZ2d@westnet.com.au> (permalink)

Show all headers | View raw


On 17/06/2021 11:06 am, Ben Bacarisse wrote:
> Andrew Poulos <ap_prog@hotmail.com> writes:
> 
>> I need to trigger up to 12 "events" with timings a user sets. The
>> timings (in seconds) could be anything from 0 to, say, 300.
>>
>> One way I though to handle them was to: put the timings into an array,
>> sort the array (from lowest to highest), loop over the array and call
>> setTimeout on each one.
> 
> Hmm...  Why not just call setTimeout without sorting them?  I must be
> missing some key part of the problem...

If I have 12 setTimeout waiting to happen and the user gives focus to a 
different "component" I'll need to clear all the setTimeout. I was 
looking for a single point to control all of them without multiple 
setTimeout.

At some later stage the client might ask for "unlimited" timings and I'd 
rather not have lots of setTimeout running at the same time.

Andrew Poulos

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Coord timed events Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-06-17 02:06 +0100
  Re: Coord timed events Andrew Poulos <ap_prog@hotmail.com> - 2021-06-17 13:17 +1000
    Re: Coord timed events Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-06-17 11:20 +0100
    Re: Coord timed events Scott Sauyet <scott@sauyet.com> - 2021-06-17 13:21 -0700
      Re: Coord timed events Andrew Poulos <ap_prog@hotmail.com> - 2021-06-18 11:03 +1000
        Re: Coord timed events Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-06-20 23:40 -0700
          Re: Coord timed events Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-06-20 23:48 -0700
            Re: Coord timed events Jonas Thörnvall <jonas.thornvall@gmail.com> - 2021-06-23 12:11 -0700

csiph-web