package virtual_dom
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=c32029907c0667369a500091533e2121c050e2392cfae7f07f2289e87c797390
doc/virtual_dom.ui_effect/Ui_effect/index.html
Module Ui_effect
module type Handler = sig ... endmodule type S = sig ... end'a Effect.t represents some computation of type 'a that can be performed outside of the typical computational/incremental structure of a Bonsai program . Examples of this computation might be:
- Calling an RPC and getting the result back
- Running expensive computation on a web-worker thread
- Requesting some information from the imperative "Start.Handle"-holding code
If you have a value of type 'a Effect.t, you can schedule it to be run by calling inject and providing a function that will be called when the callback completes.
include Core.Monad.S with type 'a t := 'a t
module Monad_infix : sig ... endval return : 'a -> 'a tmodule Let_syntax : sig ... endval never : 'a tAn effect that never completes
val lazy_ : 'a t Core.Lazy.t -> 'a tIf creating an effect could be expensive, you can wrap its construction in a lazy and pass it to this function so that its construction will be deferred until it's about to be evaluated.
val print_s : Core.Sexp.t -> unit tPrints the sexp when scheduled.
val of_sync_fun : ('query -> 'result) -> 'query -> 'result tof_sync_fun is similar to of_deferred_fun but with a synchronous function instead of a deferred one. This can be used for functions that are synchronous but side-effecting, or as a mock-function in tests that replace the usages of of_deferred_fun in the actual app.
Note that, unlike of_deferred_fun, the function must return immediately, so it's not possible to test the behaviour of tour app between calling the function and the effect becoming 'determined'. If you need to do this, see of_svar and of_query_response_tracker below.
module Expert : sig ... endmodule Private : sig ... endmodule For_testing : sig ... end