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

  1. hook (Function): Callback with created Event

Returns

(Subscription): Unsubscribe function


onCreateEffect(hook)

Arguments

  1. hook (Function): Callback with created Effect

Returns

(Subscription): Unsubscribe function


onCreateStore(hook)

Arguments

  1. hook (Function): Callback with created Store

Returns

(Subscription): Unsubscribe function


onCreateDomain(hook)

Arguments

  1. hook (Function): Callback with created Domain

Returns

(Subscription): Unsubscribe function


event(name?)

Arguments

  1. name? (string): event name

Returns

(Event): An intention to change state.


effect(name?)

Arguments

  1. name? (string): effect name

Returns

(Effect): A container for async function.


store(defaultState)

Arguments

  1. defaultState (State): store default state

Returns

(Store): An object that holds the state tree. There can be multiple stores.


domain(name?)

Arguments

  1. name? (string): domain name

Returns

(Domain): A namespace for your events, stores and effects.