Library
Module
Module type
Parameter
Class
Class type
Timelines for React
.
Rtime manages time stamp events, delayed events and delayed signals along timelines. The client chooses the concrete timeline by providing an absolute notion of time. Running the timeline at the appropriate pace is left to the client.
See examples of use.
Release 0.9.3 - Daniel Bünzli <daniel.buenzli at erratique.ch>
create earlier now
is a timeline whose absolute current time is defined by calling the function now
. earlier
is called with the timeline as an argument whenever a new deadline is scheduled before all the others on the line; this can be used to unblock a sleeping thread.
Warning earlier
must not perform React update cycles (because it may very likely be called during an update cycle).
wakeup l
is the duration until the next deadline on the timeline (if any). If duration
is negative, the timeline is late.
val progress : ?exec:bool -> t -> unit
progress exec l
immediatly removes the next deadline from the timeline and if exec
is true
(default) executes it.
Warning. Deadline executions usually perform React update cycles.
On a time stamp event occurence we distinguish :
The schedule and the occurence time may not coincide.
val stamp :
?stop:'a React.event ->
(time -> time -> 'b) ->
t ->
time ->
'b React.event
stamp stop occ l t
is an event such that :
t
on l
.occ t t'
with t' the occurence time.stop
occurs (existing deadlines are removed) or if t
is earlier than now l
when stamp
gets executed.val stamps :
?stop:'a React.event ->
?start:time ->
(time -> time -> 'b * time) ->
t ->
'b React.event
stamps stop start occ l
is an event such that :
start
(defaults to now l
).t
, occ start t
returns the stamp for the current occurence and the time of the next schedule. If the latter is earlier or equal to t
no new occurence is scheduled.stop
occurs (existing deadlines are removed) or if start
is earlier than now l
when stamps
gets exectued.val delay_e :
?stop:'a React.event ->
t ->
duration ->
'b React.event ->
'b React.event
delay_e stop l d e
is an event such that :
e
delayed by d
units of time on l
.stop
occurs (existing deadlines are removed).val delay_s :
?eq:('b -> 'b -> bool) ->
?stop:'a React.event ->
t ->
duration ->
'b ->
'b React.signal ->
'b React.signal
delay_s eq stop l d i s
is :
S.hold ?eq i (S.delay stop l d (S.changes s))