module Lwt_event:Events utilitiessig
..end
val with_finaliser : (unit -> unit) -> 'a React.event -> 'a React.event
with_finaliser f event
returns an event event'
which behave
as event
, except that f
is called when event'
is garbage
collected.val next : 'a React.event -> 'a Lwt.t
next ev
returns the next occurrence of ev
val limit : (unit -> unit Lwt.t) -> 'a React.event -> 'a React.event
limit f event
limits the rate of event
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 React.event
from f
creates an event which occurs each f ()
returns a
value. If f
raises an exception, the event is just stopped.val to_stream : 'a React.event -> 'a Lwt_stream.t
val of_stream : 'a Lwt_stream.t -> 'a React.event
of_stream stream
creates an event which occurs each time a
value is available on the stream.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) React.event -> 'a React.event -> 'b React.event
val app_p : ('a -> 'b Lwt.t) React.event -> 'a React.event -> 'b React.event
val map_s : ('a -> 'b Lwt.t) -> 'a React.event -> 'b React.event
val map_p : ('a -> 'b Lwt.t) -> 'a React.event -> 'b React.event
val filter_s : ('a -> bool Lwt.t) -> 'a React.event -> 'a React.event
val filter_p : ('a -> bool Lwt.t) -> 'a React.event -> 'a React.event
val fmap_s : ('a -> 'b option Lwt.t) -> 'a React.event -> 'b React.event
val fmap_p : ('a -> 'b option Lwt.t) -> 'a React.event -> 'b React.event
val diff_s : ('a -> 'a -> 'b Lwt.t) -> 'a React.event -> 'b React.event
val accum_s : ('a -> 'a Lwt.t) React.event -> 'a -> 'a React.event
val fold_s : ('a -> 'b -> 'a Lwt.t) -> 'a -> 'b React.event -> 'a React.event
val merge_s : ('a -> 'b -> 'a Lwt.t) -> 'a -> 'b React.event list -> 'a React.event
val run_s : 'a Lwt.t React.event -> 'a React.event
val run_p : 'a Lwt.t React.event -> 'a React.event
type
notifier
val disable : notifier -> unit
disable notif
stops the corresponding event to be monitoredval notify : ('a -> unit) -> 'a React.event -> notifier
notify f ev
calls f x
each time ev
has a value x
val notify_p : ('a -> unit Lwt.t) -> 'a React.event -> notifier
notify_p f ev
is the same as notify
except that f x
is a
thread. Calls to f
are made in parallel.val notify_s : ('a -> unit Lwt.t) -> 'a React.event -> notifier
notify_s f ev
is the same as notify
except that f x
is a
thread. Calls to f
are serialized.val always_notify : ('a -> unit) -> 'a React.event -> unit
notify
but does not return a notifierval always_notify_p : ('a -> unit Lwt.t) -> 'a React.event -> unit
notify_p
but does not return a notifierval always_notify_s : ('a -> unit Lwt.t) -> 'a React.event -> unit
notify_s
but does not return a notifier