module Lwt_obrowser: sig
.. end
This module corresponds to Lwt_unix but in an O'Browser environment.
Sleeping
val sleep : float -> unit Lwt.t
sleep d
is a threads which remain suspended for d
seconds
and then terminates.
val yield : unit -> unit Lwt.t
yield ()
is a threads which suspends itself and then resumes
as soon as possible and terminates.
Unlike Lwt_preemtive.yield
,
that version will also let the browser work if it has something to
do (for example redraw the page).
val run : 'a Lwt.t -> 'a
val http_get : string -> (string * string) list -> (int * string) Lwt.t
http_get url args
sends an HTTP GET request to the server with GET
arguments args
nicely encoded and return
(code, message)
where code
is the HTTP code and message
the content of
the answer.
val http_post : string -> (string * string) list -> (int * string) Lwt.t
http_post url args
sends an HTTP POST request to the server with POST
arguments args
nicely encoded and return
(code, message)
where code
is the HTTP code and message
the content of
the answer.
val http_get_post : string ->
(string * string) list -> (string * string) list -> (int * string) Lwt.t
http_get_post url get_args post_args
makes an HTTP POST request with
get_args
encoded and appended to url
and post_args
as POST arguments.
It's result also is (code,message)
val http_post_with_content_type : string -> string -> (string * string) list -> (int * string) Lwt.t
http_post_with_content_type url ct args
sends an HTTP POST request to the
server with POST arguments args
nicely encoded, with Content-Type set to
ct
. The returned value is (code, message)
where code
is the HTTP code
and message
the content of the answer.
val register_event : JSOO.obj -> string -> ('a -> unit Lwt.t) -> 'a -> unit
Register a Lwt thread on a DOM event.