module States:sig
..end
type'a
callback =('a -> unit) -> unit
val register_value : page:Server.Doc.page ->
name:string ->
descr:Markdown.text ->
?details:Markdown.block ->
output:'a Server.Request.output ->
get:(unit -> 'a) ->
?add_hook:unit callback -> unit -> Server.Request.signal
<name>.sig
is emitted on value updates;<name>.get
returns the current value.~add_hook
option is used to register a hook to notify the
server of value updates. The hook will be installed only once the client
starts to listen for value updates.
Inside Ivette you can use the States.useSyncValue(id)
hook to
synchronize with this value.
val register_state : page:Server.Doc.page ->
name:string ->
descr:Markdown.text ->
?details:Markdown.block ->
data:'a Server.Data.data ->
get:(unit -> 'a) ->
set:('a -> unit) ->
?add_hook:unit callback -> unit -> Server.Request.signal
<name>.sig
is emitted on value updates;<name>.get
returns the current value;<name>.set
modifies the server value.~add_hook
option is used to register a hook to notify the
server of value updates. The hook will be installed only once the client
starts to listen for value updates.
Inside Ivette you can use the States.useSyncState(id)
hook to
synchronize with this state.
type 'a
model
val model : unit -> 'a model
val column : model:'a model ->
name:string ->
descr:Markdown.text ->
data:'b Server.Request.output -> get:('a -> 'b) -> unit -> unit
type 'a
array
val reload : 'a array -> unit
val update : 'a array -> 'a -> unit
val remove : 'a array -> 'a -> unit
val signal : 'a array -> Server.Request.signal
val register_array : page:Server.Doc.page ->
name:string ->
descr:Markdown.text ->
?details:Markdown.block ->
key:('a -> string) ->
iter:'a callback ->
?add_update_hook:'a callback ->
?add_remove_hook:'a callback ->
?add_reload_hook:unit callback ->
'a model -> 'a array
<name>.sig
is emitted on array updates;<name>.fetch
is registered to get updates;<name>.reload
is registered to trigger a full reload.~key
parameter is used to identify array entries, and used to fill
the reserved column "id"
of entries.
Columns added to the model after registration are not taken into account.
If provided, the ~add_xxx_hook
options are used to register hooks
to notify the server of corresponding array updates.
Each hook will be installed only once the client starts to listen for array
updates.
Inside Ivette you can obtain the entries in sync by using the
States.useSyncArray()
hook.