App
| Module | ejs.sys |
| Namespace | "ejs.sys" |
| Definition | class App |
| Specified | Ejs-11. |
| Inheritance | App Object |
Application configuration class.
This is a singleton class which exposes methods to interrogate and control the applications environment.
Properties
| Qualifiers | Property | Type | Description |
|---|---|---|---|
| public const | UTF_16 | Number | |
| public const | UTF_8 | Number |
App Methods
| Qualifiers | Method |
|---|---|
| public get | args(): Array |
| Application command line arguments. | |
| public get | dir(): String |
| Return the directory containing the application executable. | |
| public static | exit(status: Number): Void |
| Gracefully stop the program and exit the interpreter. | |
| public static | getEnv(name: String): String |
| Get an environment variable. | |
| public get | name(): String |
| Application name. | |
| public static | noexit(exit: Boolean): Void |
| Control whether an application will exit when global scripts have completed. | |
| public static | serviceEvents(count: Number, timeout: Number): Void |
| public static | sleep(delay: Number): Void |
| Sleep the application for the given number of milliseconds. | |
| public get | title(): String |
| Application title name. | |
| public get | version(): String |
| Application version string. | |
| public get | workingDir(): String |
| Get the application's Working directory. | |
| public set | workingDir(value: String): Void |
| Set the application's Working directory. |
Method Detail
get public args(): Array
Application command line arguments.
- Returns
- An array containing each of the arguments. If the ejs command is invoked as "ejs script arg1 arg2", then args[0] will be "script", args[1] will be "arg1" etc.
get public dir(): String
Return the directory containing the application executable.
- Returns
- A string containing the directory path for the application executable.
Gracefully stop the program and exit the interpreter.
- Parameters
status: Number The optional exit code to provide the environment.
Get an environment variable.
- Parameters
name: String The name of the environment variable to retrieve.
- Returns
- The value of the environment variable or null if not found.
get public name(): String
Application name.
- Returns
- A single word, lower case name for the application.
Control whether an application will exit when global scripts have completed.
- Description
- Setting this to true will cause the application to continue servicing events until the $exit method is explicitly called. The default application setting of noexit is false.
- Parameters
exit: Boolean If true, the application will exit when the last script completes. [default: true]