Skip to content

Commit b91a280

Browse files
committed
Add Stores API
1 parent 734d8a9 commit b91a280

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

packages/element-web-module-api/src/api/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { AccountAuthApiExtension } from "./auth.ts";
1717
import { ProfileApiExtension } from "./profile.ts";
1818
import { ExtrasApi } from "./extras.ts";
1919
import { BuiltinsApi } from "./builtins.ts";
20+
import { StoresApi } from "./stores.ts";
2021
import { ClientApi } from "./client.ts";
2122

2223
/**
@@ -124,6 +125,11 @@ export interface Api
124125
*/
125126
readonly extras: ExtrasApi;
126127

128+
/**
129+
* Allows modules to access a limited functionality of certain stores from Element Web.
130+
*/
131+
readonly stores: StoresApi;
132+
127133
/**
128134
* Access some very specific functionality from the client.
129135
*/
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
Copyright 2025 New Vector Ltd.
3+
4+
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
5+
Please see LICENSE files in the repository root for full details.
6+
*/
7+
8+
import type { Room } from "../models/Room";
9+
10+
/**
11+
* Provides some basic functionality of the Room List Store from element-web.
12+
* @public
13+
*/
14+
export interface RoomListStoreApi {
15+
/**
16+
* Get a flat list of sorted room from the RLS.
17+
*/
18+
getRooms(): Room[];
19+
20+
/**
21+
* Returns a promise that resolves when RLS is ready.
22+
*/
23+
waitForReady(): Promise<void>;
24+
}
25+
26+
/**
27+
* Provides access to certain stores from element-web.
28+
* @public
29+
*/
30+
export interface StoresApi {
31+
/**
32+
* Use this to access limited functionality of the RLS from element-web.
33+
*/
34+
getRoomListStore(): RoomListStoreApi;
35+
}

packages/element-web-module-api/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@ export type * from "./api/dialog";
2020
export type * from "./api/profile";
2121
export type * from "./api/navigation";
2222
export type * from "./api/builtins";
23+
export type * from "./api/stores";
2324
export type * from "./api/client";
2425
export * from "./api/watchable";

0 commit comments

Comments
 (0)