FlitterApp

libflitter/app/FlitterApp~ FlitterApp

The Flitter application.


Constructor

new FlitterApp(units)

Instantiate the application.

Parameters:
Name Type Description
units object

mapping of names to static Unit CLASS definitions

Extends

Members

(static) name

Get the name of this app's service: 'app'

(private) __unit_array :Array.<string>

Array of unit names.

Type:
  • Array.<string>

__units :Array.<module:libflitter/Unit~Unit>

The app's units.

(private) _di_allow_defer :boolean

If true, the injector will defer the class if the class requests any services that the container is missing. These services are filled in later and added to the prototype and any instances. True by default.

Type:
  • boolean

(private) _di_deferred_instances :Array.<module:flitter-di/src/Injectable~Injectable>

Collection of instances of this class that need to have the deferred service instances injected into them when the deferred services are finally provided.

(private) _di_deferred_services :Array.<string>

List of services that were deferred and not provided at the time of injection.

Type:
  • Array.<string>

analyzer :module:libflitter/app/Analyzer~Analyzer

Analyzer used to process various aspects of the application.

directories :object

Mapping of directory names to paths.

Type:
  • object

enable_analyzer :boolean

If true, the module:libflitter/app/Analyzer~Analyzer will check the application dependencies before run.

Type:
  • boolean

express :express

The underlying Express.js app.

Type:
  • express

output :module:libflitter/utility/services/Output~Output

Instance of the output service.

Methods

(private) __init_dependency_injector()

Initialize the dependency injector for this app, adding the configured units to the container as services.

(async, private) __init_unit(unit) → {Promise.<*>}

Start a single unit.

Parameters:
Name Type Description
unit module:libflitter/Unit~Unit
Returns:
Type
Promise.<*>

(async, private) __stop_unit(unit) → {Promise.<void>}

Stop a single unit.

Parameters:
Name Type Description
unit module:libflitter/Unit~Unit
Returns:
Type
Promise.<void>

(async) app_error(e) → {Promise.<void>}

Handle an application-level error. This will cause Flitter to terminate. If the error passed is an instance of {module:libflitter/error/FatalError~FatalError}, it will terminate immediately. Otherwise, it will try to shut down cleanly.

Parameters:
Name Type Description
e Error
Returns:
Type
Promise.<void>

di() → {module:flitter-di/src/DependencyInjector~DependencyInjector}

Get the DI.

(async) down() → {Promise.<void>}

Stop the application cleanly by stopping all units.

Returns:
Type
Promise.<void>

make(Class) → {*}

Inject dependencies into the static class.

Parameters:
Name Type Description
Class module:flitter-di/src/Injectable~Injectable

the static CLASS

Deprecated:
  • Yes
Returns:
  • the injected CLASS
Type
*

(async) run() → {Promise.<void>}

Run the application by starting, then cleanly stopping all units.

Returns:
Type
Promise.<void>

(async) up() → {Promise.<void>}

Initialize the application by starting all units.

Returns:
Type
Promise.<void>