mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
adjust main.js to use SessionContainer
This commit is contained in:
parent
ad7c564d5d
commit
de7dcf6a40
24
src/main.js
24
src/main.js
@ -1,12 +1,11 @@
|
|||||||
import {HomeServerApi} from "./matrix/net/HomeServerApi.js";
|
|
||||||
// import {RecordRequester, ReplayRequester} from "./matrix/net/request/replay.js";
|
// import {RecordRequester, ReplayRequester} from "./matrix/net/request/replay.js";
|
||||||
import {fetchRequest} from "./matrix/net/request/fetch.js";
|
import {fetchRequest} from "./matrix/net/request/fetch.js";
|
||||||
import {Reconnector} from "./matrix/net/Reconnector.js";
|
import {SessionContainer} from "./matrix/SessionContainer.js";
|
||||||
import {StorageFactory} from "./matrix/storage/idb/StorageFactory.js";
|
import {StorageFactory} from "./matrix/storage/idb/StorageFactory.js";
|
||||||
import {SessionInfoStorage} from "./matrix/sessioninfo/localstorage/SessionInfoStorage.js";
|
import {SessionInfoStorage} from "./matrix/sessioninfo/localstorage/SessionInfoStorage.js";
|
||||||
import {BrawlViewModel} from "./domain/BrawlViewModel.js";
|
import {BrawlViewModel} from "./domain/BrawlViewModel.js";
|
||||||
import {BrawlView} from "./ui/web/BrawlView.js";
|
import {BrawlView} from "./ui/web/BrawlView.js";
|
||||||
import {Clock as DOMClock} from "./ui/web/dom/Clock.js";
|
import {Clock} from "./ui/web/dom/Clock.js";
|
||||||
import {OnlineStatus} from "./ui/web/dom/OnlineStatus.js";
|
import {OnlineStatus} from "./ui/web/dom/OnlineStatus.js";
|
||||||
|
|
||||||
export default async function main(container) {
|
export default async function main(container) {
|
||||||
@ -22,13 +21,22 @@ export default async function main(container) {
|
|||||||
// window.getBrawlFetchLog = () => recorder.log();
|
// window.getBrawlFetchLog = () => recorder.log();
|
||||||
// normal network:
|
// normal network:
|
||||||
const request = fetchRequest;
|
const request = fetchRequest;
|
||||||
const clock = new DOMClock();
|
const sessionInfoStorage = new SessionInfoStorage("brawl_sessions_v1");
|
||||||
|
const clock = new Clock();
|
||||||
|
|
||||||
const vm = new BrawlViewModel({
|
const vm = new BrawlViewModel({
|
||||||
storageFactory: new StorageFactory(),
|
createSessionContainer: () => {
|
||||||
createHsApi: (homeServer, accessToken, reconnector) => new HomeServerApi({homeServer, accessToken, request, reconnector}),
|
return new SessionContainer({
|
||||||
sessionInfoStorage: new SessionInfoStorage("brawl_sessions_v1"),
|
random: Math.random,
|
||||||
clock: new DOMClock(),
|
onlineStatus: new OnlineStatus(),
|
||||||
|
storageFactory: new StorageFactory(),
|
||||||
|
sessionInfoStorage,
|
||||||
|
request,
|
||||||
|
clock,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
sessionInfoStorage,
|
||||||
|
clock,
|
||||||
});
|
});
|
||||||
await vm.load();
|
await vm.load();
|
||||||
const view = new BrawlView(vm);
|
const view = new BrawlView(vm);
|
||||||
|
Loading…
Reference in New Issue
Block a user