Constructors

  • 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 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.

    Parameters

    • opts: StateLookupOpts

      Options for this constructor

    Returns StateLookup

    Throws

    if there is no client.

Methods

  • Get a stored state event.

    Parameters

    • roomId: string
    • eventType: string
    • Optional stateKey: 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[]

  • Update any state dictionaries with this event. If there is nothing tracking this room, nothing is stored.

    Parameters

    Returns Promise<void>

  • 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 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.

  • 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