Skip to content

Commit

Permalink
perf: freeze constants
Browse files Browse the repository at this point in the history
Signed-off-by: Varun Patil <[email protected]>
  • Loading branch information
pulsejet committed Oct 13, 2023
1 parent d6e1088 commit 044d94f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/services/utils/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down

0 comments on commit 044d94f

Please sign in to comment.