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.
createEvent(name?)
Arguments
name
? (string): event name
Returns
Event: New event
createEffect(name?)
Arguments
name
? (string): effect name
Returns
Effect: A container for async function.
createStore(defaultState)
Arguments
defaultState
(State): store default state
Returns
Store: New store
createDomain(name?)
Arguments
name
? (string): domain name
Returns
Domain: New domain
event(name?)
Arguments
name
? (string): event name
Returns
Event: New event
effect(name?)
Arguments
name
? (string): effect name
Returns
Effect: New effect
store(defaultState)
Arguments
defaultState
(State): store default state
Returns
Store: New store
domain(name?)
Arguments
name
? (string): domain name
Returns
Domain: New domain