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
22
src/main.js
22
src/main.js
@ -1,12 +1,11 @@
|
||||
import {HomeServerApi} from "./matrix/net/HomeServerApi.js";
|
||||
// import {RecordRequester, ReplayRequester} from "./matrix/net/request/replay.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 {SessionInfoStorage} from "./matrix/sessioninfo/localstorage/SessionInfoStorage.js";
|
||||
import {BrawlViewModel} from "./domain/BrawlViewModel.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";
|
||||
|
||||
export default async function main(container) {
|
||||
@ -22,13 +21,22 @@ export default async function main(container) {
|
||||
// window.getBrawlFetchLog = () => recorder.log();
|
||||
// normal network:
|
||||
const request = fetchRequest;
|
||||
const clock = new DOMClock();
|
||||
const sessionInfoStorage = new SessionInfoStorage("brawl_sessions_v1");
|
||||
const clock = new Clock();
|
||||
|
||||
const vm = new BrawlViewModel({
|
||||
createSessionContainer: () => {
|
||||
return new SessionContainer({
|
||||
random: Math.random,
|
||||
onlineStatus: new OnlineStatus(),
|
||||
storageFactory: new StorageFactory(),
|
||||
createHsApi: (homeServer, accessToken, reconnector) => new HomeServerApi({homeServer, accessToken, request, reconnector}),
|
||||
sessionInfoStorage: new SessionInfoStorage("brawl_sessions_v1"),
|
||||
clock: new DOMClock(),
|
||||
sessionInfoStorage,
|
||||
request,
|
||||
clock,
|
||||
});
|
||||
},
|
||||
sessionInfoStorage,
|
||||
clock,
|
||||
});
|
||||
await vm.load();
|
||||
const view = new BrawlView(vm);
|
||||
|
Loading…
Reference in New Issue
Block a user