Skip to content

Commit

Permalink
feat: added enums in a separate folder to use for constant values ins…
Browse files Browse the repository at this point in the history
…tead of using string datatype
  • Loading branch information
Sadaf-A committed Feb 25, 2024
1 parent dcfab68 commit e5abb53
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import * as NL_CONSTANTS from './types/enums';

declare global {
interface Window {
// --- globals ---
/** Mode of the application: window, browser, cloud, or chrome */
NL_MODE: string;
NL_MODE: NL_CONSTANTS.MODE;
/** Application port */
NL_PORT: number;
/** Command-line arguments */
Expand All @@ -20,9 +22,9 @@ interface Window {
/** Returns true if extensions are enabled */
NL_EXTENABLED: boolean;
/** Operating system name: Linux, Windows, Darwin, FreeBSD, or Uknown */
NL_OS: string;
NL_OS: NL_CONSTANTS.OS;
/** CPU architecture: x64, arm, itanium, ia32, or unknown */
NL_ARCH: string;
NL_ARCH: NL_CONSTANTS.ARCH;
/** Neutralinojs server version */
NL_VERSION: string;
/** Current working directory */
Expand Down
22 changes: 22 additions & 0 deletions src/types/enums.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
export enum MODE {
Window,
Browser,
Cloud,
Chrome
}

export enum OS {
Linux,
Windows,
Darwin,
FreeBSD,
Unknown
}

export enum ARCH {
x64,
Arm,
Itanium,
ia32,
Unknown
}

0 comments on commit e5abb53

Please sign in to comment.