Domain
Domain is a namespace for your events, stores and effects.
Domain can subscribe to event, effect, store or nested domain creation with onCreateEvent
, onCreateStore
, onCreateEffect
, onCreateDomain
methods.
It is useful for logging or other side effects.
Domain Methods
onCreateEvent(hook)
Arguments
hook
(Function): Callback with created Event
Returns
(Subscription): Unsubscribe function
onCreateEffect(hook)
Arguments
hook
(Function): Callback with created Effect
Returns
(Subscription): Unsubscribe function
onCreateStore(hook)
Arguments
hook
(Function): Callback with created Store
Returns
(Subscription): Unsubscribe function
onCreateDomain(hook)
Arguments
hook
(Function): Callback with created Domain
Returns
(Subscription): Unsubscribe function
event(name?)
Arguments
name
? (string): event name
Returns
(Event
): An intention to change state.
effect(name?)
Arguments
name
? (string): effect name
Returns
(Effect
): A container for async function.
store(defaultState)
Arguments
defaultState
(State): store default state
Returns
(Store
): An object that holds the state tree. There can be multiple stores.
domain(name?)
Arguments
name
? (string): domain name
Returns
(Domain
): A namespace for your events, stores and effects.