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 static const | UTF_16 | Number | |
| public static const | UTF_8 | Number |
App Methods
| Qualifiers | Method |
|---|---|
| public static get | args(): Array |
| Application command line arguments. | |
| public static | chdir(value: Object): Void |
| Change the application's Working directory. | |
| public static get | dir(): Path |
| Get the application's current directory. | |
| public static get | errorStream(): Stream |
| Get the standard error file stream. | |
| public static set | errorStream(stream: Stream): Void |
| Set the standard error stream. | |
| public static get | exeDir(): Path |
| Return the directory containing the application executable. | |
| public static get | exePath(): Path |
| Return the application executable path. | |
| 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 static set | inputStream(stream: Stream): Void |
| Set the standard input stream. | |
| public static get | inputStream(): Stream |
| Get the standard input file stream. | |
| public static get | name(): String |
| Application name. | |
| public static | noexit(exit: Boolean): Void |
| Control whether an application will exit when global scripts have completed. | |
| public static get | outputStream(): Stream |
| Get the standard output file stream. | |
| public static set | outputStream(stream: Stream): Void |
| Set the standard output stream. | |
| public static set | searchPath(path: String): Void |
| public static get | searchPath(): String |
| public static | serviceEvents(count: Number, timeout: Number): Void |
| Service events. | |
| public static | sleep(delay: Number): Void |
| Sleep the application for the given number of milliseconds. | |
| public static get | title(): String |
| Application title name. | |
| public static get | version(): String |
| Application version string. |
Method Detail
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 the application's current directory.
- Returns
- The path to the current directory.
Get the standard error file stream.
- Returns
- A stream object.
Set the standard error stream.
- Parameters
stream: Stream The output stream.
Return the directory containing the application executable.
- Returns
- A string containing the directory for the application executable.
Return the application executable path.
- Returns
- A string containing the application executable file name.
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.
Set the standard input stream.
- Parameters
stream: Stream The input stream.
Get the standard input file stream.
- Returns
- A stream object.
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]
Get the standard output file stream.
- Returns
- A stream object.
Set the standard output stream.
- Parameters
stream: Stream The output stream.
Sleep the application for the given number of milliseconds.
- Parameters
delay: Number Time in milliseconds to sleep. Set to -1 to sleep forever.
Application title name.
- Description
- Multi word, Camel Case name for the application.
- Returns
- The name of the application suitable for printing.
Application version string.
- Returns
- A version string of the format Major.Minor.Patch. For example: 1.1.2.