package vue-jsoo

  1. Overview
  2. Docs
type ('state, 'getters) action_input = {
  1. state : 'state Mjs.t;
  2. getters : 'getters Mjs.t;
  3. commit : ?payload:Mjs.any -> string -> unit;
  4. dispatch : ?payload:Mjs.any -> string -> Mjs.unit_promise Mjs.t;
  5. root_state : Mjs.any option;
  6. root_getters : Mjs.any option;
}

input for actions

type 'payload mutation = {
  1. name : string;
  2. payload : 'payload;
}

mutation type for subscribe

module Internal : sig ... end

internal JS module

type ('state, 'getters) options = ('state, 'getters) Internal.options = {
  1. o_state : 'state Mjs.t;
  2. o_getters : ('state Mjs.t -> Mjs.any) Mjs.table_cons;
  3. mutations : ('state Mjs.t -> Mjs.any -> unit) Mjs.table_cons;
  4. actions : (('state, 'getters) action_input -> Mjs.any -> unit) Mjs.table_cons;
  5. plugins : Mjs.any list option;
  6. strict : bool option;
  7. devtools : bool option;
  8. modules : (Mjs.top, Mjs.top) Internal.dynamic_cs_options Mjs.t Mjs.table_cons;
  9. namespaced : bool option;
}

store constructor options

class type 'state store = 'state Internal.instance_js

JS store object

class type ['state, 'getters] module_obj = ['state, 'getters] Internal.dynamic_cs_options

JS module object

val empty : 'state Mjs.t -> ('state, 'getters) options

empty constructor options

val make : ('state, 'getters) options -> 'state store Mjs.t

main make store function

val make_module : ('state, 'getters) options -> ('state, 'getters) module_obj Mjs.t

make module store function

val state : 'state store Mjs.t -> 'state Mjs.t

get state of store

val get : 'state store Mjs.t -> string -> Mjs.any

get value of one of the getters

val commit : ?payload:Mjs.any -> ?root:bool -> 'state store Mjs.t -> string -> unit

commit to the state of the store

val dispatch : ?payload:Mjs.any -> ?root:bool -> 'state store Mjs.t -> string -> (Mjs.unit_promise Mjs.t -> 'async) -> 'async

dispatch to the state of the store

val replace_state : 'state store Mjs.t -> 'state Mjs.t -> unit

replace the state of the store

val subscribe : 'state store Mjs.t -> ('a mutation -> 'state Mjs.t -> unit) -> unit

hook for mutation subscription

val subscribe_action : 'state store Mjs.t -> ('a mutation -> 'state Mjs.t -> unit) -> unit

hook for action subscription

val register_module : 'state store Mjs.t -> string -> (Mjs.top, Mjs.top) options -> unit

register a new module to the store

val unregister_module : 'state store Mjs.t -> string -> unit

unregister a module of the store

val has_module : 'state store Mjs.t -> string -> bool

module existence

val hot_update : 'state store Mjs.t -> 'a -> unit
module Map : sig ... end

Binding helpers

module type Tables_S = sig ... end
module Tables (S : sig ... end) : Tables_S with type state = S.state and type getters = S.getters
module type Make_S = sig ... end
module Make (S : sig ... end) : Make_S with type state = S.state and type getters = S.getters
module type Module_S = sig ... end
module Module (S : sig ... end) : Module_S with type state = S.state and type getters = S.getters