Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SDK documentation to reflect latest code changes #1077

Merged
merged 3 commits into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion doc/SDK.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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';
Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down