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


Groups > comp.lang.javascript > #34707 > unrolled thread

micro TimeScheduler in Javascript?

Started byJonas Thörnvall <jonas.thornvall@gmail.com>
First post2018-02-05 03:38 -0800
Last post2018-02-05 05:55 -0800
Articles 3 — 3 participants

Back to article view | Back to comp.lang.javascript


Contents

  micro TimeScheduler in Javascript? Jonas Thörnvall <jonas.thornvall@gmail.com> - 2018-02-05 03:38 -0800
    Re: micro TimeScheduler in Javascript? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-02-05 14:21 +0100
      Re: micro TimeScheduler in Javascript? Julio Di Egidio <julio@diegidio.name> - 2018-02-05 05:55 -0800

#34707 — micro TimeScheduler in Javascript?

FromJonas Thörnvall <jonas.thornvall@gmail.com>
Date2018-02-05 03:38 -0800
Subjectmicro TimeScheduler in Javascript?
Message-ID<75df6bed-18f8-4a3d-90bf-7d9f694c7a7d@googlegroups.com>
In timecritical applications it seem one often need some form of scheduler that takes a list of timings, to perform some sort of batch?
The jobs done and ready but waiting to be sent on certain time?

setSchedule(myFunction,myArraywithTimings);

I have a hard to even figure out if i should use setTimeout or setInterval to playup recorded events with their relative timing "in microseconds", or if there is other options?

[toc] | [next] | [standalone]


#34709

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2018-02-05 14:21 +0100
Message-ID<XnsA88092163C773eejj99@194.109.6.166>
In reply to#34707
Jonas <jonas.thornvall@gmail.com> wrote on 05
Feb 2018 in comp.lang.javascript: 

> In timecritical applications it seem one often need some form of
> scheduler that takes a list of timings, to perform some sort of batch? 
> The jobs done and ready but waiting to be sent on certain time?
> 
> setSchedule(myFunction,myArraywithTimings);
> 
> I have a hard to even figure out if i should use setTimeout

setTimeout fires only once, so that is whay you want, it seems.

> or setInterval

setInterval fires repeatedly

> to playup recorded events with their relative timing "in
> microseconds", or if there is other options? 

You could poll a list ["schedule"] of tasks every so many miliseconds,
microseconds being outside the realm of practical scripting applications.


 
> 



-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#34710

FromJulio Di Egidio <julio@diegidio.name>
Date2018-02-05 05:55 -0800
Message-ID<570782b8-4004-46ff-99aa-50265a17ff9c@googlegroups.com>
In reply to#34709
On Monday, 5 February 2018 14:21:43 UTC+1, Evertjan.  wrote:
> Jonas <jonas.thornvall@gmail.com> wrote on 05
> Feb 2018 in comp.lang.javascript: 
<snip>
> > to playup recorded events with their relative timing "in
> > microseconds", or if there is other options? 
> 
> You could poll a list ["schedule"] of tasks every so many miliseconds,

Polling might be overkill, usually just fire the setTimeout: if you want a
schedule that persists across browser sessions, you'll have to record events,
and remove them when they have executed, still at session start you can
simply scan the list and just fire the timeouts again.

> microseconds being outside the realm of practical scripting applications.

Yep, and even milliseconds or even seconds: not only the timer is low
precision, when a timeout expires, the handler is marked for execution but
shall wait for its turn to run if there are other calls already running and
in the run queue.  That said, indeed one hardly needs high precision timers
in the context of web scripting, or, more generally, user interfaces.

Julio

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web