perf: freeze constants

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/877/head
Varun Patil 2023-10-13 12:22:25 -07:00
parent d6e108831e
commit 044d94f3b9
1 changed files with 4 additions and 4 deletions

View File

@ -2,7 +2,7 @@ import { IPhoto } from '../../types';
import { loadState } from '@nextcloud/initial-state'; import { loadState } from '@nextcloud/initial-state';
/** Global constants */ /** Global constants */
export const c = { export const c = Object.freeze({
// Flags for photos // Flags for photos
FLAG_PLACEHOLDER: 1 << 0, FLAG_PLACEHOLDER: 1 << 0,
FLAG_LOAD_FAIL: 1 << 1, FLAG_LOAD_FAIL: 1 << 1,
@ -14,16 +14,16 @@ export const c = {
// Special strings // Special strings
FACE_NULL: 'NULL', FACE_NULL: 'NULL',
}; });
/** /**
* Initial state pulled from Nextcloud's HTML page * Initial state pulled from Nextcloud's HTML page
*/ */
export const initState = { export const initState = Object.freeze({
noDownload: loadState('memories', 'no_download', false) !== false, noDownload: loadState('memories', 'no_download', false) !== false,
shareTitle: loadState('memories', 'share_title', '') as string, shareTitle: loadState('memories', 'share_title', '') as string,
singleItem: loadState('memories', 'single_item', null) as IPhoto | null, singleItem: loadState('memories', 'single_item', null) as IPhoto | null,
}; });
/** /**
* Convert server-side flags to bitmask * Convert server-side flags to bitmask