diff --git a/src/PageSystem/PageRouter.ts b/src/PageSystem/PageRouter.ts index 555d895..1c73f24 100644 --- a/src/PageSystem/PageRouter.ts +++ b/src/PageSystem/PageRouter.ts @@ -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 { + public async getCurrentPage(): Promise { return this.currentPage; } diff --git a/src/PageSystem/PageType.ts b/src/PageSystem/PageType.ts new file mode 100644 index 0000000..c8004fd --- /dev/null +++ b/src/PageSystem/PageType.ts @@ -0,0 +1,9 @@ +import { PageRouter } from "./PageRouter"; + +export type PageType = { + render(): Promise; + getPageTitle(): Promise; + goBack(): Promise; + cleanup(): Promise; + setRouterAndState(router: PageRouter, state: unknown): Promise; +} \ No newline at end of file