Flarum (v2.0.0-beta.6)
    Preparing search index...

    The Store class defines a local data store, and provides methods to retrieve data from the API.

    Index

    Constructors

    Properties

    data: StoreData = {}

    The local data store. A tree of resource types to IDs, such that accessing data[type][id] will return the model for that type/ID.

    models: Record<string, new () => Model>

    The model registry. A map of resource types to the model class that should be used to represent resources of that type.

    Methods

    • Get a record from the store by the value of a model attribute.

      Type Parameters

      Parameters

      • type: string

        The resource type.

      • key: keyof M

        The name of the method on the model.

      • value: T

        The value of the model attribute.

      Returns M | undefined