Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • StateLookup

Index

Constructors

constructor

  • Construct a new state lookup entity.

    This component stores state events for specific event types which can be queried at a later date. This component will perform network requests to fetch the current state for a given room ID. It relies on {@link StateLookup#onEvent} being called with later events in order to stay up-to-date. This should be connected to the onEvent handler on the Bridge.

    throws

    if there is no client.

    Parameters

    • opts: StateLookupOpts

      Options for this constructor

    Returns StateLookup

Methods

getState

  • Get a stored state event.

    Parameters

    • roomId: string
    • eventType: string
    • Optional stateKey: undefined | string

      If specified, this function will return either the event or null. If not specified, this function will always return an array of events, which may be empty.

    Returns null | StateLookupEvent | StateLookupEvent[]

onEvent

trackRoom

  • trackRoom(roomId: string): Promise<StateLookupRoom>
  • Track a given room. The client must have access to this room.

    This will perform a room state query initially. Subsequent calls will do nothing, as it will rely on events being pushed to it via {@link StateLookup#onEvent}.

    Parameters

    • roomId: string

      The room ID to start tracking. You can track multiple rooms by calling this function multiple times with different room IDs.

    Returns Promise<StateLookupRoom>

    Resolves when the room is being tracked. Rejects if the room cannot be tracked.

untrackRoom

  • untrackRoom(roomId: string): void
  • Stop tracking a given room.

    This will stop further tracking of state events in the given room and delete existing stored state for it.

    Parameters

    • roomId: string

      The room ID to stop tracking.

    Returns void

Generated using TypeDoc