package bonsai
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=43f35d648644492d776bf2c7b86c8227e7793615b6a658432e95f8dccd3631f8
md5=b5e743dbfa64d0da5fd660f14cd0b549
doc/bonsai.web/Bonsai_web/Start/index.html
Module Bonsai_web.Start
Start
handles the entire lifecycle of web-based Bonsai application.
Put another way, Start
is like Core.Command
for Bonsai_web apps.
module Handle : sig ... end
module App_input : sig ... end
The input of an application-level component is a value of type ('input, 'outgoing) App_input.t
.
module App_result : sig ... end
The result of an application-level component is a value of type 'incoming App_result.t
. This value contains the view of the app, and also an inject function: a way for the holder of the Handle.t
to send events into the application component.
Start functions
val start_standalone :
initial_input:'input ->
bind_to_element_with_id:string ->
('input, Virtual_dom.Vdom.Node.t) Bonsai_web__.Import.Bonsai.t ->
('input, unit, Core_kernel.Nothing.t, Core_kernel.Nothing.t) Handle.t
Start an application, receiving a handle that can't schedule any actions.
The outermost Bonsai.t
's result type parameter should be a Vdom.Node.t
, which will be bound to the DOM element with id bind_to_element_with_id
.
val start :
initial_input:'input ->
bind_to_element_with_id:string ->
(('input, 'outgoing) App_input.t, ('extra, 'incoming) App_result.t)
Bonsai_web__.Import.Bonsai.t ->
('input, 'extra, 'incoming, 'outgoing) Handle.t
Start an application, receiving a handle that can schedule actions of a user-defined type.
The outermost Bonsai.t
's result type parameter should be a pair consisting of:
- a
Vdom.Node.t
, which will be bound to the DOM element with idbind_to_element_with_id
; and - an
inject
function that accepts external actions and returnsVdom.Event.t
s.