Applesauce
    Preparing search index...

    Class EventModels<E, TStore>

    Base class that provides model functionality for both sync and async event stores. This class can be extended by other packages to add additional helpful subscription methods.

    // In another package (e.g., applesauce-common)
    import { EventModels } from "applesauce-core/event-store";

    // Add methods to the prototype
    EventModels.prototype.mutes = function(user) {
    return this.model(MuteModel, user);
    };

    // Extend the type via module augmentation
    declare module "applesauce-core/event-store" {
    interface EventModels {
    mutes(user: string | ProfilePointer): Observable<Mutes | undefined>;
    }
    }

    Type Parameters

    Hierarchy (View Summary)

    Implements

    Index
    destroy$: ReplaySubject<void> = ...

    Emits when EventModels.dispose is called to tear down all models. A ReplaySubject so reset notifiers subscribed after disposal fire immediately.

    modelKeepWarm: number = 60_000

    How long a model should be kept "warm" while nothing is subscribed to it

    models: Map<
        ModelConstructor<any, any[], E, TStore>,
        Map<string, Observable<any>>,
    > = ...

    A directory of all active models

    • Tears down all models, completing active subscriptions and releasing their keep-warm timers immediately.

      Returns void

      This is a terminal operation; the instance should be discarded after calling it.