@squidcloud/client
    Preparing search index...

    Interface SnapshotEmitter<ReturnType>

    Interface for emitting query results in a reactive manner, supporting both synchronous and asynchronous access.

    interface SnapshotEmitter<ReturnType> {
        paginate(options?: Partial<PaginationOptions>): Pagination<ReturnType>;
        peek(): ReturnType[];
        serialize(): SerializedQuery;
        snapshot(): Promise<ReturnType[]>;
        snapshots(subscribe?: boolean): Observable<ReturnType[]>;
    }

    Type Parameters

    • ReturnType

    Implemented by

    Index

    Methods

    • Returns the results of the query based on the data that is currently available on the client. This method is useful for synchronously accessing data that has already been fetched by another query. The method will return an empty array if data has not yet been populated.

      Returns ReturnType[]

      An array of query results.

    • Returns a promise that resolves to the query results.

      Returns Promise<ReturnType[]>

      A promise that resolves to the query results.

    • Returns an observable that emits the query results and updates whenever the query results change unless subscribe=false is provided.

      Important: Make sure to unsubscribe from the observable when you are done with it.

      Parameters

      • Optionalsubscribe: boolean

        Whether to subscribe to changes to the query results. Defaults to true.

      Returns Observable<ReturnType[]>

      An observable for the query results.