package ocaml-canvas
Library
Module
Module type
Parameter
Class
Class type
Initialization and event loop control
run k
executes the backend event loop, calling update functions as needed, and calling the continuation function k
when the event loop terminates. Note that the call to run
MUST be the last instruction in your program (to avoid different behaviors between the native and javascript backends). If you need to perform additional stuff when the program terminates, you MUST use the k
function: it is meant for that. Note that calling run
from an update function will just be ignored (though this should not be done). However, run
may be called from the k
function, if needed.
Exceptions:
Exception.Not_initialized
ifBackend.init
was not called
stop ()
requests termination of the currently running event loop, if any. It should be called from an update function. Actual termination of the event loop will occur at the end of the current iteration of the event loop, so after calling stop
an update function should proceed normally until it returns.
Exceptions:
Exception.Not_initialized
ifBackend.init
was not called
val getCanvas : int -> Canvas.t
getCanvas i
returns the canvas that has id i
, if it exists
Exceptions:
Exception.Not_initialized
ifBackend.init
was not calledNot_found
if no canvas has idi
val getCurrentTimestamp : unit -> Event.timestamp
getCurrentTimestamp ()
returns the current timestamp in microseconds, from an arbitrary starting point
Exceptions:
Exception.Not_initialized
ifBackend.init
was not called