module App:sig..end
val env : string -> default:'a -> (string -> 'a) -> 'aenv var ~default parse lookups var in the environment, parses
it with parse and returns the result. If parse raises or
if var is not in the environment default is returned.
Data lookup depends on the backend:
`Tsdl uses Sys.getenv.`Jsoo lookups the query string of window.location
for the first matching var=value pair.val prefs_path : org:string -> app:string -> (string, [ `Msg of string ]) Result.resultTODO this should used the app name automatically.
Unique to user and app.val quit : unit React.eventquit occurs whenever the user requested to quit. The meaning
depends on the backend:
`Tsdl, this is only a hint, e.g. the last window
was closed or a platform dependent way of quitting
applications was invoked`Jsoo, the browser window is closing and it's your
last chance to peform somethingval init : ?name:string ->
?surface:Useri.Surface.t -> unit -> (unit, [ `Msg of string ]) Result.resultinit name surface initialises an application named name (default
derived from the executable name) with surface surface (defaults
to a default Useri.Surface.create.)val run_step : unit -> Useri.Time.spanrun_step () gather as much user input as possible and returns
the maximal timespan after which Useri.App.run_step should be called again.val run : ?until:'a React.event -> unit -> unitrun until depends on the backend scheme:
`Sync invokes Useri.App.run_step repeatedly and blocks until
the first occurence of until (defaults to Useri.App.quit).
After Useri.App.run returned it can be called again.`Async returns immediately, until is irrelevant.val release : ?sinks:bool -> unit -> unitrelease sinks () does the following:
Useri.App.stop event occur.sinks is true (default), calls Useri.App.release_sinks.
After a Useri.App.release it should be possible to Useri.App.init again.
val start : unit React.event
val stop : unit React.event
val sink_event : 'a React.event -> unitsink_event e keeps a reference on e until the app exits.val sink_signal : 'a React.signal -> unitsink_signal s keeps a reference on s until the app exits.val release_sinks : unit -> unit
typelaunch_context =[ `Browser | `Gui | `Terminal ]
val launch_context : launch_contextlaunch_context is the mechanism that started the program.val pp_launch_context : Format.formatter -> launch_context -> unitpp_launch_context ppf c prints an unspecified representation of
c on ppf.val platform : stringplatform is the name of the platform you are running on.
Warning. Do not expect different backend to report the same
platform with the same string.
typebackend =[ `Jsoo | `Other of string | `Tsdl ]
Useri's backends.val backend : backendbackend is Useri's current backend.val pp_backend : Format.formatter -> backend -> unitpp_backend ppf b prints an unspecified representation of
c on ppf.val set_backend_logger : ([ `Error | `Warning ] -> string -> unit) -> unitset_backend_logger log sets log to be called by backends
whenever non-fatal internal warnings and errors are generated.
The default function outputs and flushes to stderr.typebackend_scheme =[ `Async | `Sync ]
`Sync, the backend is synchronous the client of the library
is in charge of running the event loop by using Useri.App.run_step
or Useri.App.run.`Async, the backend is asynchronous, there's an inversion
of control, the call to Useri.App.run won't block.val backend_scheme : [ `Async | `Sync ]backend_scheme is the Useri's current backend's scheme.val pp_backend_scheme : Format.formatter -> backend_scheme -> unitpp_backend_scheme ppf bs prints and unspecified representation of
bs on ppf.typecpu_count =[ `Known of int | `Unknown ]
val cpu_count : cpu_countcpu_count is the number of CPU available.val pp_cpu_count : Format.formatter -> cpu_count -> unitpp_cpu_count ppf c prints an unspecified representation of c
on ppf.