package lwt

  1. Overview
  2. Docs
include module type of React.E
type 'a t = 'a React.event
val never : 'a React.event
val create : unit -> 'a React.event * (?step:React.step -> 'a -> unit)
val retain : 'a React.event -> (unit -> unit) -> [ `R of unit -> unit ]
val stop : ?strong:bool -> 'a React.event -> unit
val equal : 'a React.event -> 'a React.event -> bool
val trace : ?iff:bool React.signal -> ('a -> unit) -> 'a React.event -> 'a React.event
val once : 'a React.event -> 'a React.event
val drop_once : 'a React.event -> 'a React.event
val app : ('a -> 'b) React.event -> 'a React.event -> 'b React.event
val map : ('a -> 'b) -> 'a React.event -> 'b React.event
val stamp : 'b React.event -> 'a -> 'a React.event
val filter : ('a -> bool) -> 'a React.event -> 'a React.event
val fmap : ('a -> 'b option) -> 'a React.event -> 'b React.event
val diff : ('a -> 'a -> 'b) -> 'a React.event -> 'b React.event
val changes : ?eq:('a -> 'a -> bool) -> 'a React.event -> 'a React.event
val on : bool React.signal -> 'a React.event -> 'a React.event
val when_ : bool React.signal -> 'a React.event -> 'a React.event
val dismiss : 'b React.event -> 'a React.event -> 'a React.event
val until : 'a React.event -> 'b React.event -> 'b React.event
val accum : ('a -> 'a) React.event -> 'a -> 'a React.event
val fold : ('a -> 'b -> 'a) -> 'a -> 'b React.event -> 'a React.event
val select : 'a React.event list -> 'a React.event
val merge : ('a -> 'b -> 'a) -> 'a -> 'b React.event list -> 'a React.event
val switch : 'a React.event -> 'a React.event React.event -> 'a React.event
val fix : ('a React.event -> 'a React.event * 'b) -> 'b
val l1 : ('a -> 'b) -> 'a React.event -> 'b React.event
val l2 : ('a -> 'b -> 'c) -> 'a React.event -> 'b React.event -> 'c React.event
val l3 : ('a -> 'b -> 'c -> 'd) -> 'a React.event -> 'b React.event -> 'c React.event -> 'd React.event
val l4 : ('a -> 'b -> 'c -> 'd -> 'e) -> 'a React.event -> 'b React.event -> 'c React.event -> 'd React.event -> 'e React.event
val l5 : ('a -> 'b -> 'c -> 'd -> 'e -> 'f) -> 'a React.event -> 'b React.event -> 'c React.event -> 'd React.event -> 'e React.event -> 'f React.event
val l6 : ('a -> 'b -> 'c -> 'd -> 'e -> 'f -> 'g) -> 'a React.event -> 'b React.event -> 'c React.event -> 'd React.event -> 'e React.event -> 'f React.event -> 'g React.event
module Option : sig ... end

Lwt-specific utilities

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

with_finaliser f e returns an event e' which behave as e, except that f is called when e' is garbage collected.

val next : 'a event -> 'a Lwt.t

next e returns the next occurrence of e

val limit : (unit -> unit Lwt.t) -> 'a event -> 'a event

limit f e limits the rate of e with f.

For example, to limit the rate of an event to 1 per second you can use: limit (fun () -> Lwt_unix.sleep 1.0) event.

val from : (unit -> 'a Lwt.t) -> 'a event

from f creates an event which occurs each time f () returns a value. If f raises an exception, the event is just stopped.

val to_stream : 'a event -> 'a Lwt_stream.t

Creates a stream holding all values occurring on the given event

val of_stream : 'a Lwt_stream.t -> 'a event

of_stream stream creates an event which occurs each time a value is available on the stream.

val delay : 'a event Lwt.t -> 'a event

delay thread is an event which does not occurs until thread returns. Then it behaves as the event returned by thread.

val keep : 'a event -> unit

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

Threaded versions of React transformation functions

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

As usual the _s suffix is used when calls are serialized, and the _p suffix is used when they are not.

Note that *_p functions may not preserve event order.

val app_s : ('a -> 'b Lwt.t) event -> 'a event -> 'b event
val app_p : ('a -> 'b Lwt.t) event -> 'a event -> 'b event
val map_s : ('a -> 'b Lwt.t) -> 'a event -> 'b event
val map_p : ('a -> 'b Lwt.t) -> 'a event -> 'b event
val filter_s : ('a -> bool Lwt.t) -> 'a event -> 'a event
val filter_p : ('a -> bool Lwt.t) -> 'a event -> 'a event
val fmap_s : ('a -> 'b option Lwt.t) -> 'a event -> 'b event
val fmap_p : ('a -> 'b option Lwt.t) -> 'a event -> 'b event
val diff_s : ('a -> 'a -> 'b Lwt.t) -> 'a event -> 'b event
val accum_s : ('a -> 'a Lwt.t) event -> 'a -> 'a event
val fold_s : ('a -> 'b -> 'a Lwt.t) -> 'a -> 'b event -> 'a event
val merge_s : ('a -> 'b -> 'a Lwt.t) -> 'a -> 'b event list -> 'a event
val run_s : 'a Lwt.t event -> 'a event
val run_p : 'a Lwt.t event -> 'a event
OCaml

Innovation. Community. Security.