Effect (core)
Types & Interfaces
EffectConfig
import { EffectConfig } from '@hexajs-dev/core';
interface EffectConfig {
dispatch?: boolean;
}
Functions
createEffect
Creates a managed effect from an RxJS pipeline factory.
The returned Observable is tagged so the framework can:
- Auto-subscribe it at bootstrap time
- Route emitted actions back to store.dispatch() (unless dispatch: false)
- Recover from errors (dead-stream protection)
- Auto-unsubscribe on lifecycle destroy (HMR, navigation, suspend)
Must be used inside an
import { createEffect } from '@hexajs-dev/core';
function createEffect(factory: () => Observable<HexaAction>, config?: EffectConfig): Observable<HexaAction>
subscribeEffects
Discovers all createEffect-tagged properties on an instance, subscribes each with dead-stream recovery, and routes dispatching effects back to the store.
Returns a composite Subscription that unsubscribes all effects at once. The generator calls this at bootstrap and adds the subscription to lifecycle cleanup.
import { subscribeEffects } from '@hexajs-dev/core';
function subscribeEffects(instance: any, dispatch: (action: HexaAction) => void): Subscription