mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
Give defaultt type
This commit is contained in:
parent
f49d580d49
commit
9300347e9b
@ -27,6 +27,7 @@ import type {Platform} from "../platform/web/Platform";
|
||||
import type {Clock} from "../platform/web/dom/Clock";
|
||||
import type {ILogger} from "../logging/types";
|
||||
import type {Navigation} from "./navigation/Navigation";
|
||||
import type {SegmentType} from "./navigation/index";
|
||||
import type {URLRouter} from "./navigation/URLRouter";
|
||||
|
||||
type Options<N extends {session: string}> = {
|
||||
@ -37,7 +38,7 @@ type Options<N extends {session: string}> = {
|
||||
emitChange?: (params: any) => void
|
||||
}
|
||||
|
||||
export class ViewModel<N extends {session: string}, O extends Options<N> = Options<N>> extends EventEmitter<{change: never}> {
|
||||
export class ViewModel<N extends {session: string} = SegmentType, O extends Options<N> = Options<N>> extends EventEmitter<{change: never}> {
|
||||
private disposables?: Disposables;
|
||||
private _isDisposed = false;
|
||||
private _options: Readonly<O>;
|
||||
|
@ -18,7 +18,7 @@ import {Navigation, Segment} from "./Navigation";
|
||||
import {URLRouter} from "./URLRouter";
|
||||
import type {Path, OptionalValue} from "./Navigation";
|
||||
|
||||
type SegmentType = {
|
||||
export type SegmentType = {
|
||||
"login": true;
|
||||
"session": string;
|
||||
"sso": string;
|
||||
@ -124,7 +124,7 @@ export function addPanelIfNeeded<T extends SegmentType>(navigation: Navigation<T
|
||||
}
|
||||
|
||||
export function parseUrlPath(urlPath: string, currentNavPath: Path<SegmentType>, defaultSessionId?: string): Segment<SegmentType>[] {
|
||||
// substr(1) to take of initial /
|
||||
// substring(1) to take of initial /
|
||||
const parts = urlPath.substring(1).split("/");
|
||||
const iterator = parts[Symbol.iterator]();
|
||||
const segments: Segment<SegmentType>[] = [];
|
||||
|
Loading…
Reference in New Issue
Block a user