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.


createEvent(name?)

Arguments

  1. name? (string): event name

Returns

Event: New event


createEffect(name?)

Arguments

  1. name? (string): effect name

Returns

Effect: A container for async function.


createStore(defaultState)

Arguments

  1. defaultState (State): store default state

Returns

Store: New store


createDomain(name?)

Arguments

  1. name? (string): domain name

Returns

Domain: New domain


event(name?)

Arguments

  1. name? (string): event name

Returns

Event: New event


effect(name?)

Arguments

  1. name? (string): effect name

Returns

Effect: New effect


store(defaultState)

Arguments

  1. defaultState (State): store default state

Returns

Store: New store


domain(name?)

Arguments

  1. name? (string): domain name

Returns

Domain: New domain