package lwt_react

  1. Overview
  2. Docs
include module type of React.S
type 'a t = 'a React.signal
val const : 'a -> 'a React.signal
val create : ?eq:('a -> 'a -> bool) -> 'a -> 'a React.signal * (?step:React.step -> 'a -> unit)
val value : 'a React.signal -> 'a
val retain : 'a React.signal -> (unit -> unit) -> [ `R of unit -> unit ]
val eq_fun : 'a React.signal -> ('a -> 'a -> bool) option
val stop : ?strong:bool -> 'a React.signal -> unit
val equal : ?eq:('a -> 'a -> bool) -> 'a React.signal -> 'a React.signal -> bool
val trace : ?iff:bool t -> ('a -> unit) -> 'a React.signal -> 'a React.signal
val hold : ?eq:('a -> 'a -> bool) -> 'a -> 'a React.event -> 'a React.signal
val app : ?eq:('b -> 'b -> bool) -> ('a -> 'b) React.signal -> 'a React.signal -> 'b React.signal
val map : ?eq:('b -> 'b -> bool) -> ('a -> 'b) -> 'a React.signal -> 'b React.signal
val filter : ?eq:('a -> 'a -> bool) -> ('a -> bool) -> 'a -> 'a React.signal -> 'a React.signal
val fmap : ?eq:('b -> 'b -> bool) -> ('a -> 'b option) -> 'b -> 'a React.signal -> 'b React.signal
val diff : ('a -> 'a -> 'b) -> 'a React.signal -> 'b React.event
val changes : 'a React.signal -> 'a React.event
val sample : ('b -> 'a -> 'c) -> 'b React.event -> 'a React.signal -> 'c React.event
val on : ?eq:('a -> 'a -> bool) -> bool React.signal -> 'a -> 'a React.signal -> 'a React.signal
val when_ : ?eq:('a -> 'a -> bool) -> bool React.signal -> 'a -> 'a React.signal -> 'a React.signal
val dismiss : ?eq:('a -> 'a -> bool) -> 'b React.event -> 'a -> 'a React.signal -> 'a React.signal
val accum : ?eq:('a -> 'a -> bool) -> ('a -> 'a) React.event -> 'a -> 'a React.signal
val fold : ?eq:('a -> 'a -> bool) -> ('a -> 'b -> 'a) -> 'a -> 'b React.event -> 'a React.signal
val merge : ?eq:('a -> 'a -> bool) -> ('a -> 'b -> 'a) -> 'a -> 'b React.signal list -> 'a React.signal
val switch : ?eq:('a -> 'a -> bool) -> 'a React.signal React.signal -> 'a React.signal
val fix : ?eq:('a -> 'a -> bool) -> 'a -> ('a React.signal -> 'a React.signal * 'b) -> 'b
val l1 : ?eq:('b -> 'b -> bool) -> ('a -> 'b) -> 'a React.signal -> 'b React.signal
val l2 : ?eq:('c -> 'c -> bool) -> ('a -> 'b -> 'c) -> 'a React.signal -> 'b React.signal -> 'c React.signal
val l3 : ?eq:('d -> 'd -> bool) -> ('a -> 'b -> 'c -> 'd) -> 'a React.signal -> 'b React.signal -> 'c React.signal -> 'd React.signal
val l4 : ?eq:('e -> 'e -> bool) -> ('a -> 'b -> 'c -> 'd -> 'e) -> 'a React.signal -> 'b React.signal -> 'c React.signal -> 'd React.signal -> 'e React.signal
val l5 : ?eq:('f -> 'f -> bool) -> ('a -> 'b -> 'c -> 'd -> 'e -> 'f) -> 'a React.signal -> 'b React.signal -> 'c React.signal -> 'd React.signal -> 'e React.signal -> 'f React.signal
val l6 : ?eq:('g -> 'g -> bool) -> ('a -> 'b -> 'c -> 'd -> 'e -> 'f -> 'g) -> 'a React.signal -> 'b React.signal -> 'c React.signal -> 'd React.signal -> 'e React.signal -> 'f React.signal -> 'g React.signal
module Bool : sig ... end
module Int : sig ... end
module Float : sig ... end
module Pair : sig ... end
module Option : sig ... end
module Compare : sig ... end
module type EqType = sig ... end
module type S = sig ... end
module Make (Eq : EqType) : sig ... end
module Special : sig ... end

Monadic interface

val return : 'a -> 'a signal

Same as const.

val bind : ?eq:('b -> 'b -> bool) -> 'a signal -> ('a -> 'b signal) -> 'b signal

bind ?eq s f is initially f x where x is the current value of s. Each time s changes to a new value y, bind signal f is set to f y, until the next change of signal.

val bind_s : ?eq:('b -> 'b -> bool) -> 'a signal -> ('a -> 'b signal Lwt.t) -> 'b signal Lwt.t

Same as bind except that f returns a promise. Calls to f are serialized.

Lwt-specific utilities

val with_finaliser : (unit -> unit) -> 'a signal -> 'a signal

with_finaliser f s returns a signal s' which behaves as s, except that f is called when s' is garbage collected.

val limit : ?eq:('a -> 'a -> bool) -> (unit -> unit Lwt.t) -> 'a signal -> 'a signal

limit f s limits the rate of s update with f.

For example, to limit it to 1 per second, you can use: limit (fun () -> Lwt_unix.sleep 1.0) s.

val keep : 'a signal -> unit

keep s keeps a reference to s so it will never be garbage collected.

Threaded versions of React transformation functions

The following functions behave as their React counterpart, except that they take functions that may yield.

The _s suffix means that calls are serialized.

val app_s : ?eq:('b -> 'b -> bool) -> ('a -> 'b Lwt.t) signal -> 'a signal -> 'b signal Lwt.t
val map_s : ?eq:('b -> 'b -> bool) -> ('a -> 'b Lwt.t) -> 'a signal -> 'b signal Lwt.t
val filter_s : ?eq:('a -> 'a -> bool) -> ('a -> bool Lwt.t) -> 'a -> 'a signal -> 'a signal Lwt.t
val fmap_s : ?eq:('b -> 'b -> bool) -> ('a -> 'b option Lwt.t) -> 'b -> 'a signal -> 'b signal Lwt.t
val diff_s : ('a -> 'a -> 'b Lwt.t) -> 'a signal -> 'b event
val sample_s : ('b -> 'a -> 'c Lwt.t) -> 'b event -> 'a signal -> 'c event
val accum_s : ?eq:('a -> 'a -> bool) -> ('a -> 'a Lwt.t) event -> 'a -> 'a signal
val fold_s : ?eq:('a -> 'a -> bool) -> ('a -> 'b -> 'a Lwt.t) -> 'a -> 'b event -> 'a signal
val merge_s : ?eq:('a -> 'a -> bool) -> ('a -> 'b -> 'a Lwt.t) -> 'a -> 'b signal list -> 'a signal Lwt.t
val l1_s : ?eq:('b -> 'b -> bool) -> ('a -> 'b Lwt.t) -> 'a signal -> 'b signal Lwt.t
val l2_s : ?eq:('c -> 'c -> bool) -> ('a -> 'b -> 'c Lwt.t) -> 'a signal -> 'b signal -> 'c signal Lwt.t
val l3_s : ?eq:('d -> 'd -> bool) -> ('a -> 'b -> 'c -> 'd Lwt.t) -> 'a signal -> 'b signal -> 'c signal -> 'd signal Lwt.t
val l4_s : ?eq:('e -> 'e -> bool) -> ('a -> 'b -> 'c -> 'd -> 'e Lwt.t) -> 'a signal -> 'b signal -> 'c signal -> 'd signal -> 'e signal Lwt.t
val l5_s : ?eq:('f -> 'f -> bool) -> ('a -> 'b -> 'c -> 'd -> 'e -> 'f Lwt.t) -> 'a signal -> 'b signal -> 'c signal -> 'd signal -> 'e signal -> 'f signal Lwt.t
val l6_s : ?eq:('g -> 'g -> bool) -> ('a -> 'b -> 'c -> 'd -> 'e -> 'f -> 'g Lwt.t) -> 'a signal -> 'b signal -> 'c signal -> 'd signal -> 'e signal -> 'f signal -> 'g signal Lwt.t
val run_s : ?eq:('a -> 'a -> bool) -> 'a Lwt.t signal -> 'a signal Lwt.t
OCaml

Innovation. Community. Security.