Base concepts

Concept of entities which Foxstore is based on.

Event

/**
 * Atomaric data-unit, that may contain info
 *
 * @export
 * @class Event
 */
export declare class FoxEvent<Payload = unknown> {
    name: string | symbol;
    payload?: Payload | Observable<Payload> | Promise<Payload> | undefined;
    constructor(name: string | symbol, payload?: Payload | Observable<Payload> | Promise<Payload> | undefined);
}

Event is minimal data-wrapper that can be sent through eventbus named Dispatcher. Simply, it is a pair of key - name - and value - payload.

Dispatcher

/**
 * Simple Event-manager
 *
 * @export
 * @class Dispatcher
 */
export declare class Dispatcher {
    constructor(initEvent?: FoxEvent, scheduler?: SchedulerLike);
    dispatch(event: FoxEvent): void;
    listen(...eventNames: (string | symbol)[]): Observable<FoxEvent>;
    emitDestroy(): void;
    get destroy$(): Observable<FoxEvent<unknown>>;
}

Dispatcher is simple event manager that can dispatch and listen events. Dispatcher is eventbus that can be shared between different modules or any other entities in your app.

Last updated

Was this helpful?