Merge pull request #1077 from vector-im/update-sdk-1

Update SDK documentation to reflect latest code changes
This commit is contained in:
R Midhun Suresh 2023-04-17 21:15:38 +05:30 committed by GitHub
commit e77727ea59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -15,6 +15,7 @@ yarn create vite
cd <your-project-name>
yarn
yarn add hydrogen-view-sdk
yarn add https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.14.tgz
```
You should see a `index.html` in the project root directory, containing an element with `id="app"`. Add the attribute `class="hydrogen"` to this element, as the CSS we'll include from the SDK assumes for now that the app is rendered in an element with this classname.
@ -32,7 +33,8 @@ import {
createRouter,
RoomViewModel,
TimelineView,
viewClassForTile
viewClassForTile,
FeatureSet
} from "hydrogen-view-sdk";
import downloadSandboxPath from 'hydrogen-view-sdk/download-sandbox.html?url';
import workerPath from 'hydrogen-view-sdk/main.js?url';
@ -81,12 +83,14 @@ async function main() {
const {session} = client;
// looks for room corresponding to #element-dev:matrix.org, assuming it is already joined
const room = session.rooms.get("!bEWtlqtDwCLFIAKAcv:matrix.org");
const features = await FeatureSet.load(platform.settingsStorage);
const vm = new RoomViewModel({
room,
ownUserId: session.userId,
platform,
urlRouter: urlRouter,
navigation,
features,
});
await vm.load();
const view = new TimelineView(vm.timelineViewModel, viewClassForTile);

View File

@ -22,6 +22,7 @@ export {Platform} from "./platform/web/Platform.js";
export {BlobHandle} from "./platform/web/dom/BlobHandle";
export {Client, LoadStatus} from "./matrix/Client.js";
export {RoomStatus} from "./matrix/room/common";
export {FeatureSet, FeatureFlag} from "./features";
// export everything needed to observe state events on all rooms using session.observeRoomState
export type {RoomStateHandler} from "./matrix/room/state/types";
export type {MemberChange} from "./matrix/room/members/RoomMember";