mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
WIP
This commit is contained in:
parent
404de53c75
commit
01ff806b86
@ -34,6 +34,19 @@ export class BrawlViewModel extends ViewModel {
|
||||
|
||||
this._sessionContainer = null;
|
||||
this._sessionCallback = this._sessionCallback.bind(this);
|
||||
|
||||
this.track(this.navigation.observe("login").subscribe(value => {
|
||||
if (value) {
|
||||
this._showLogin();
|
||||
}
|
||||
}));
|
||||
this.track(this.navigation.observe("session").subscribe(value => {
|
||||
if (value === true) {
|
||||
this._showPicker();
|
||||
} else if (value) {
|
||||
alert("showing session " + value);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
async load() {
|
||||
|
@ -25,10 +25,15 @@ export class URLRouter {
|
||||
|
||||
start() {
|
||||
this._subscription = this._pathObservable.subscribe(url => {
|
||||
const segments = this._segmentsFromUrl(url);
|
||||
const path = this._navigation.pathFrom(segments);
|
||||
this._navigation.applyPath(path);
|
||||
this._applyUrl(url);
|
||||
});
|
||||
this._applyUrl(this._pathObservable.get());
|
||||
}
|
||||
|
||||
_applyUrl(url) {
|
||||
const segments = this._segmentsFromUrl(url);
|
||||
const path = this._navigation.pathFrom(segments);
|
||||
this._navigation.applyPath(path);
|
||||
}
|
||||
|
||||
stop() {
|
||||
@ -36,7 +41,7 @@ export class URLRouter {
|
||||
}
|
||||
|
||||
_segmentsFromUrl(path) {
|
||||
const parts = path.split("/");
|
||||
const parts = path.split("/").filter(p => !!p);
|
||||
let index = 0;
|
||||
const segments = [];
|
||||
while (index < parts.length) {
|
||||
|
Loading…
Reference in New Issue
Block a user