Skip to content

Commit

Permalink
feat: using enums instead of string for constants
Browse files Browse the repository at this point in the history
  • Loading branch information
Sadaf-A committed Feb 24, 2024
1 parent 34f0a6a commit e6f3a18
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
22 changes: 22 additions & 0 deletions src/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
}
8 changes: 5 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { MODE, OS, ARCH } from './enums';

declare global {
interface Window {
// --- globals ---
/** Mode of the application: window, browser, cloud, or chrome */
NL_MODE: string;
NL_MODE: 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 Unknown */
NL_OS: string;
NL_OS: OS;
/** CPU architecture: x64, arm, itanium, ia32, or unknown */
NL_ARCH: string;
NL_ARCH: ARCH;
/** Neutralinojs server version */
NL_VERSION: string;
/** Current working directory */
Expand Down

0 comments on commit e6f3a18

Please sign in to comment.