UNPKG

matrix-react-sdk

Version:
31 lines (30 loc) 1.57 kB
import EventEmitter from "events"; import { IWidget } from "matrix-widget-api"; import { MatrixEvent } from "matrix-js-sdk/src/matrix"; import { WidgetType } from "../widgets/WidgetType"; /** * Acts as a place to get & set widget state, storing local echo state and * proxying through state from the js-sdk. */ declare class WidgetEchoStore extends EventEmitter { private roomWidgetEcho; constructor(); /** * Gets the widgets for a room, subtracting those that are pending deletion. * Widgets that are pending addition are not included, since widgets are * represented as MatrixEvents, so to do this we'd have to create fake MatrixEvents, * and we don't really need the actual widget events anyway since we just want to * show a spinner / prevent widgets being added twice. * * @param {string} roomId The ID of the room to get widgets for * @param {MatrixEvent[]} currentRoomWidgets Current widgets for the room * @returns {MatrixEvent[]} List of widgets in the room, minus any pending removal */ getEchoedRoomWidgets(roomId: string, currentRoomWidgets: MatrixEvent[]): MatrixEvent[]; roomHasPendingWidgetsOfType(roomId: string, currentRoomWidgets: MatrixEvent[], type?: WidgetType): boolean; roomHasPendingWidgets(roomId: string, currentRoomWidgets: MatrixEvent[]): boolean; setRoomWidgetEcho(roomId: string, widgetId: string, state: IWidget): void; removeRoomWidgetEcho(roomId: string, widgetId: string): void; } declare const _default: WidgetEchoStore; export default _default;