From 044d94f3b93f36a1e7f62c2edfa5044edabe75f7 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Fri, 13 Oct 2023 12:22:25 -0700 Subject: [PATCH] perf: freeze constants Signed-off-by: Varun Patil --- src/services/utils/const.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/services/utils/const.ts b/src/services/utils/const.ts index f963b50b..e3357cae 100644 --- a/src/services/utils/const.ts +++ b/src/services/utils/const.ts @@ -2,7 +2,7 @@ import { IPhoto } from '../../types'; import { loadState } from '@nextcloud/initial-state'; /** Global constants */ -export const c = { +export const c = Object.freeze({ // Flags for photos FLAG_PLACEHOLDER: 1 << 0, FLAG_LOAD_FAIL: 1 << 1, @@ -14,16 +14,16 @@ export const c = { // Special strings FACE_NULL: 'NULL', -}; +}); /** * Initial state pulled from Nextcloud's HTML page */ -export const initState = { +export const initState = Object.freeze({ noDownload: loadState('memories', 'no_download', false) !== false, shareTitle: loadState('memories', 'share_title', '') as string, singleItem: loadState('memories', 'single_item', null) as IPhoto | null, -}; +}); /** * Convert server-side flags to bitmask