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 const UTF_16Number 
public const UTF_8Number 

App Methods

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

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.

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 public serviceEvents(count: Number, timeout: Number): Void

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.

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.

get public version(): String

Application version string.

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

get public workingDir(): String

Get the application's Working directory.

Returns
The path to the working directory.

set public workingDir(value: String): Void

Set the application's Working directory.

Parameters

Embedthis Software LLC, 2003-2009. All rights reserved. Embedthis is a trademark of Embedthis Software LLC.