UtilityUnit

libflitter/utility/UtilityUnit~ UtilityUnit

The utility unit contains various utility functions and tools that are made available to almost all other units. Currently, a function for restricting console.log calls by logging level is the one method included. Also provides the path to the root folder of the app.

Constructor

new UtilityUnit()

Source:

Extends

Methods

(async) cleanup(app) → {Promise.<void>}

Source:
Inherited From:

Cleans up the unit's resources before Flitter closes.

Parameters:
Name Type Description
app module:libflitter/app/FlitterApp~FlitterApp

the Flitter app

Returns:
Type
Promise.<void>

directives() → {Object}

Source:

Get the directives provided by this unit.

Returns:
Type
Object

directories() → {Object}

Source:
Inherited From:

Get the directories provided by the unit. Should be an object such that key => value is the name of the directory => fully qualified path to the directory.

Returns:
Type
Object

(async) go(app, context) → {Promise.<void>}

Source:
Overrides:

Loads the unit. Binds the application root and global logging function to the appropriate contexts.

Parameters:
Name Type Description
app module:libflitter/app/FlitterApp~FlitterApp

the Flitter app

context module:libflitter/Context~Context

the unit's context

Returns:
Type
Promise.<void>

log(message, level, strictopt)

Source:

Prints a message to the console iff the logging level configured in "server.logging.level" is less than the specified message level. This function is usually bound to the unit's context and the app's global context.

Parameters:
Name Type Attributes Default Description
message string

the message to be printed

level Number 1

the level of the message to be printed

strict boolean <optional>
false

if true, print the message iff the message level is exactly equal to the configured logging level.

name() → {string}

Source:
Overrides:

Get the name of this unit.

Returns:

"utility"

Type
string

root() → {string}

Source:

Get the fully-qualified path to the root folder of the Flitter application.

Returns:
Type
string