mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-27 17:27:32 +08:00
added page name type
This commit is contained in:
parent
fd48402840
commit
381ee144c5
3 changed files with 16 additions and 5 deletions
|
|
@ -4,7 +4,7 @@ interface Options {
|
|||
}
|
||||
|
||||
export default class Page {
|
||||
public name: string;
|
||||
public name: MonkeyTypes.PageName;
|
||||
public element: JQuery;
|
||||
public pathname: string;
|
||||
public beforeHide: () => Promise<void>;
|
||||
|
|
@ -12,7 +12,7 @@ export default class Page {
|
|||
public beforeShow: (options: Options) => Promise<void>;
|
||||
public afterShow: () => Promise<void>;
|
||||
constructor(
|
||||
name: string,
|
||||
name: MonkeyTypes.PageName,
|
||||
element: JQuery,
|
||||
pathname: string,
|
||||
beforeHide: () => Promise<void>,
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
let activePage = "loading";
|
||||
let activePage: MonkeyTypes.PageName = "loading";
|
||||
|
||||
export function get(): string {
|
||||
export function get(): MonkeyTypes.PageName {
|
||||
return activePage;
|
||||
}
|
||||
|
||||
export function set(active: string): void {
|
||||
export function set(active: MonkeyTypes.PageName): void {
|
||||
activePage = active;
|
||||
}
|
||||
|
|
|
|||
11
frontend/src/ts/types/types.d.ts
vendored
11
frontend/src/ts/types/types.d.ts
vendored
|
|
@ -1,6 +1,17 @@
|
|||
type typesSeparatedWithHash<T> = T | `${T}#${typesSeparatedWithHash<T>}`;
|
||||
|
||||
declare namespace MonkeyTypes {
|
||||
type PageName =
|
||||
| "loading"
|
||||
| "test"
|
||||
| "settings"
|
||||
| "about"
|
||||
| "account"
|
||||
| "login"
|
||||
| "profile"
|
||||
| "profileSearch"
|
||||
| "404";
|
||||
|
||||
type Difficulty = "normal" | "expert" | "master";
|
||||
|
||||
type Mode = keyof PersonalBests;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue