Make PageType seporate rom Page.
This commit is contained in:
parent
4e390d3e96
commit
1e95a2af87
|
@ -1,9 +1,9 @@
|
|||
import { Page } from "./Page";
|
||||
import { PageType } from "./PageType";
|
||||
import { PageState } from "../PageState";
|
||||
import { getObjectKeys } from "../utils";
|
||||
|
||||
type pageList = {
|
||||
[key: string]: Page;
|
||||
[key: string]: PageType;
|
||||
};
|
||||
|
||||
const PageDoesNotExistError = new Error("Page does not exist.");
|
||||
|
@ -25,7 +25,7 @@ export class PageRouter extends EventTarget {
|
|||
|
||||
private pages: pageList;
|
||||
private currentPageID: string;
|
||||
private currentPage: Page;
|
||||
private currentPage: PageType;
|
||||
|
||||
public state: PageState;
|
||||
public pageContentElement: HTMLElement;
|
||||
|
@ -35,7 +35,7 @@ export class PageRouter extends EventTarget {
|
|||
return getObjectKeys(this.pages);
|
||||
}
|
||||
|
||||
public async getCurrentPage(): Promise<Page> {
|
||||
public async getCurrentPage(): Promise<PageType> {
|
||||
return this.currentPage;
|
||||
}
|
||||
|
||||
|
|
9
src/PageSystem/PageType.ts
Normal file
9
src/PageSystem/PageType.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { PageRouter } from "./PageRouter";
|
||||
|
||||
export type PageType = {
|
||||
render(): Promise<void>;
|
||||
getPageTitle(): Promise<Element | string>;
|
||||
goBack(): Promise<void>;
|
||||
cleanup(): Promise<void>;
|
||||
setRouterAndState(router: PageRouter, state: unknown): Promise<void>;
|
||||
}
|
Loading…
Reference in a new issue