diff --git a/assets/ts/utils.ts b/assets/ts/utils.ts index e2e21e7..9717d03 100644 --- a/assets/ts/utils.ts +++ b/assets/ts/utils.ts @@ -1,3 +1,7 @@ +/** + * custom helpers + */ + export function increment(num: number, length: number): number { return (num + 1) % length } @@ -14,6 +18,14 @@ export function isMobile(): boolean { return window.matchMedia('(hover: none)').matches } +export function getRandom(min: number, max: number) { + return Math.floor(Math.random() * (max - min + 1)) + min +} + +/** + * custom types + */ + export class Watchable { constructor(private obj: T) {} private watchers: (() => void)[] = []