Module Lwt_react.E
module E : sig..end
include React.E
Lwt-specific utilities ¶
val with_finaliser :
(unit -> unit) -> 'a Lwt_react.event -> 'a Lwt_react.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 Lwt_react.event -> 'a Lwt.t
next e returns the next occurrence of e
val limit :
(unit -> unit Lwt.t) -> 'a Lwt_react.event -> 'a Lwt_react.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 Lwt_react.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 Lwt_react.event -> 'a Lwt_stream.t
Creates a stream holding all values occurring on the given event
val of_stream : 'a Lwt_stream.t -> 'a Lwt_react.event
of_stream stream creates an event which occurs each time a value is available on the stream.
val delay : 'a Lwt_react.event Lwt.t -> 'a Lwt_react.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 Lwt_react.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) Lwt_react.event ->
'a Lwt_react.event -> 'b Lwt_react.event
val app_p :
('a -> 'b Lwt.t) Lwt_react.event ->
'a Lwt_react.event -> 'b Lwt_react.event
val map_s : ('a -> 'b Lwt.t) -> 'a Lwt_react.event -> 'b Lwt_react.event
val map_p : ('a -> 'b Lwt.t) -> 'a Lwt_react.event -> 'b Lwt_react.event
val filter_s :
('a -> bool Lwt.t) -> 'a Lwt_react.event -> 'a Lwt_react.event
val filter_p :
('a -> bool Lwt.t) -> 'a Lwt_react.event -> 'a Lwt_react.event
val fmap_s :
('a -> 'b option Lwt.t) -> 'a Lwt_react.event -> 'b Lwt_react.event
val fmap_p :
('a -> 'b option Lwt.t) -> 'a Lwt_react.event -> 'b Lwt_react.event
val diff_s :
('a -> 'a -> 'b Lwt.t) -> 'a Lwt_react.event -> 'b Lwt_react.event
val accum_s : ('a -> 'a Lwt.t) Lwt_react.event -> 'a -> 'a Lwt_react.event
val fold_s :
('a -> 'b -> 'a Lwt.t) ->
'a -> 'b Lwt_react.event -> 'a Lwt_react.event
val merge_s :
('a -> 'b -> 'a Lwt.t) ->
'a -> 'b Lwt_react.event list -> 'a Lwt_react.event
val run_s : 'a Lwt.t Lwt_react.event -> 'a Lwt_react.event
val run_p : 'a Lwt.t Lwt_react.event -> 'a Lwt_react.event