WIP on AppTile2 transformation
This commit is contained in:
parent
96fa34eecf
commit
4ea3376abf
4 changed files with 106 additions and 52 deletions
|
@ -51,6 +51,25 @@ export class WidgetMessagingStore extends AsyncStoreWithClient<unknown> {
|
|||
this.widgetMap.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds a widget by ID. Not guaranteed to return an accurate result.
|
||||
* @param {string} id The widget ID.
|
||||
* @returns {{widget, room}} The widget and possible room ID, or a falsey value
|
||||
* if not found.
|
||||
* @deprecated Do not use.
|
||||
*/
|
||||
public findWidgetById(id: string): { widget: Widget, room?: Room } {
|
||||
for (const key of this.widgetMap.keys()) {
|
||||
for (const [entityId, surrogate] of this.widgetMap.get(key).entries()) {
|
||||
if (surrogate.definition.id === id) {
|
||||
const room: Room = this.matrixClient?.getRoom(entityId); // will be null for non-rooms
|
||||
return {room, widget: surrogate.definition};
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the messaging instance for the widget. Returns a falsey value if none
|
||||
* is present.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue