App

Moduleejs.sys
Namespace"ejs.sys"
Definition class App
SpecifiedEjs-11.
InheritanceApp inherit Object

Application configuration class.

This is a singleton class which exposes methods to interrogate and control the applications environment.


Properties

QualifiersPropertyTypeDescription
public static const UTF_16Number 
public static const UTF_8Number 

App Methods

QualifiersMethod
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

static 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.

static public chdir(value: Object): Void

Change the application's Working directory.

Parameters

static get public dir(): Path

Get the application's current directory.

Returns
The path to the current directory.

static get public errorStream(): Stream

Get the standard error file stream.

Returns
A stream object.

static set public errorStream(stream: Stream): Void

Set the standard error stream.

Parameters
stream: Stream The output stream.

static get public exeDir(): Path

Return the directory containing the application executable.

Returns
A string containing the directory for the application executable.

static get public exePath(): Path

Return the application executable path.

Returns
A string containing the application executable file name.

static public exit(status: Number): Void

Gracefully stop the program and exit the interpreter.

Parameters
status: Number The optional exit code to provide the environment.

static public getEnv(name: String): String

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.

static set public inputStream(stream: Stream): Void

Set the standard input stream.

Parameters
stream: Stream The input stream.

static get public inputStream(): Stream

Get the standard input file stream.

Returns
A stream object.

static get public name(): String

Application name.

Returns
A single word, lower case name for the application.

static public noexit(exit: Boolean): Void

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]

static get public outputStream(): Stream

Get the standard output file stream.

Returns
A stream object.

static set public outputStream(stream: Stream): Void

Set the standard output stream.

Parameters
stream: Stream The output stream.

static set public searchPath(path: String): Void

static get public searchPath(): String

static public serviceEvents(count: Number, timeout: Number): Void

Service events.

Parameters
count: Number Count of events to service. Defaults to unlimited.
timeout: Number Timeout to block waiting for an event in milliseconds before returning. If an event occurs, the call returns immediately.

static public sleep(delay: Number): Void

Sleep the application for the given number of milliseconds.

Parameters
delay: Number Time in milliseconds to sleep. Set to -1 to sleep forever.

static get public title(): String

Application title name.

Description
Multi word, Camel Case name for the application.
Returns
The name of the application suitable for printing.

static get public version(): String

Application version string.

Returns
A version string of the format Major.Minor.Patch. For example: 1.1.2.