Skip to content

Commit c393040

Browse files
Merge pull request #113 from element-hq/midhun/multiroom/navigation
Add `openRoom` action to Navigation
2 parents 17a7089 + b58b5ec commit c393040

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

packages/element-web-module-api/element-web-module-api.api.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,18 @@ export class ModuleLoader {
305305

306306
// @public
307307
export interface NavigationApi {
308+
openRoom(roomIdOrAlias: string, opts?: OpenRoomOptions): void;
308309
// @alpha
309310
registerLocationRenderer(path: string, renderer: LocationRenderFunction): void;
310311
toMatrixToLink(link: string, join?: boolean): Promise<void>;
311312
}
312313

314+
// @public
315+
export interface OpenRoomOptions {
316+
autoJoin?: boolean;
317+
viaServers?: string[];
318+
}
319+
313320
// @alpha
314321
export type OriginalMessageComponentProps = {
315322
showUrlPreview?: boolean;

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

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,22 @@ import { JSX } from "react";
1414
*/
1515
export type LocationRenderFunction = () => JSX.Element;
1616

17+
/**
18+
* The options available for changing the open behaviour.
19+
* @public
20+
*/
21+
export interface OpenRoomOptions {
22+
/**
23+
* The list of servers to join via.
24+
*/
25+
viaServers?: string[];
26+
27+
/**
28+
* Whether to automatically join the room if we are not already in it.
29+
*/
30+
autoJoin?: boolean;
31+
}
32+
1733
/**
1834
* API methods to navigate the application.
1935
* @public
@@ -33,4 +49,11 @@ export interface NavigationApi {
3349
* @alpha
3450
*/
3551
registerLocationRenderer(path: string, renderer: LocationRenderFunction): void;
52+
53+
/**
54+
* Open a room in element-web.
55+
* @param roomIdOrAlias - id/alias of the room to open
56+
* @param opts - Options to control the open action, see {@link OpenRoomOptions}
57+
*/
58+
openRoom(roomIdOrAlias: string, opts?: OpenRoomOptions): void;
3659
}

0 commit comments

Comments
 (0)