Skip to content

Commit

Permalink
♻️ [Scripts] Mark some static props as readonly
Browse files Browse the repository at this point in the history
  • Loading branch information
beefchimi committed Aug 6, 2024
1 parent 9f6d47e commit ef55af3
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/scripts/PageLoad.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export type HtmlReady = 'loading' | 'done' | 'error';

export class PageLoad {
static MOTION_DELAY = 1200;
static readonly MOTION_DELAY = 1200;

static documentState() {
return document.readyState;
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/Portfolio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class Portfolio {
// re-appear everytime the url is updated (ex: via replaceState). I am
// simply disabling this behaviour for now... but I may need to do a
// user-agent sniff in order to work around it.
static SUPPORT_URL_UPDATES = false;
static readonly SUPPORT_URL_UPDATES = false;

constructor(selectors?: Selectors, onScroll?: CustomScrollFn) {
this.#selector = {
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/PwaServiceWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type PwaReloadFn = ((reloadPage?: boolean) => Promise<void>) | undefined;
export class PwaServiceWorker {
// TODO: We probably want to initialize a global singleton
// that gets imported and shared in various places.
static #tracker = new ToastTracker();
static readonly #tracker = new ToastTracker();
static #refreshWorker: PwaReloadFn;

static install() {
Expand Down
4 changes: 2 additions & 2 deletions src/scripts/SecretEmail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ const DEFAULT_CLASSNAMES = {
};

export class SecretEmail {
static defaultSecretClass = DEFAULT_CLASSNAMES.secret;
static defaultReplaceClass = DEFAULT_CLASSNAMES.replace;
static readonly defaultSecretClass = DEFAULT_CLASSNAMES.secret;
static readonly defaultReplaceClass = DEFAULT_CLASSNAMES.replace;

readonly email: string;
readonly secretClass: string;
Expand Down
4 changes: 2 additions & 2 deletions src/scripts/ToastTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ type AddArgs = ConstructorParameters<typeof ToastNotification>;

// TODO: Add event for `count` change using `emitten`.
export class ToastTracker {
static MAX_SIZE = 10;
static DISMISS_AFTER_MS = 9999;
static readonly MAX_SIZE = 10;
static readonly DISMISS_AFTER_MS = 9999;

#portal: HTMLElement;
#queue: Map<string, ToastNotification>;
Expand Down

0 comments on commit ef55af3

Please sign in to comment.