package bonsai

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Functions that take bonsai values that contain t, and kicking off reads whenever those values change.

The arguments here are chosen to match the results from Bonsai_web_ui_form.Elements.File_picker. So you can do things like:

let%sub file_picker =
  Bonsai_web_ui_form.Elements.File_picker.create [%here] ()
in
let%sub current_file =
  Bonsai_web_ui_file.Read_on_change file_picker
in
match%sub current_file with
| Starting | In_progress _ -> Bonsai.const "file still loading"
| Complete (Error e) -> Bonsai.read (e >>| Error.to_string_hum)
| Complete (Ok (_filename, contents)) -> Bonsai.read contents

NOTE: these computations are not safe for use in Tangle as internally they require a model which cannot be of_sexp'd.

module Status : sig ... end
val create_single : t Bonsai.Value.t -> (Core.Filename.t * Status.t) Bonsai.Computation.t
val create_single_opt : t option Bonsai.Value.t -> (Core.Filename.t * Status.t) option Bonsai.Computation.t
val create_multiple : t Core.Filename.Map.t Bonsai.Value.t -> Status.t Core.Filename.Map.t Bonsai.Computation.t
OCaml

Innovation. Community. Security.