The Global Unit

libflitter/global/GlobalUnit

exports:  class GlobalUnit

class GlobalUnit

extends:  libflitter/Unit

The GlobalUnit initializes the global _flit object, which contains stores for things like templates, directories, and service names, as well as a number of convenience functions. It is also the recommended way for custom Flitter units to expose global variables and functions.

go(express app, function next)

overrides:  super.go()         returns:  undefined

This function initializes GlobalUnit, as required by the parent class. It creates the global _flit object and executes the next() unit in the chain from within its context. Provides the Global context.

Global Context

This context provides access to _flit.

global._flit

type:  Object

Contains stores for things like templates, directories, and service names, as well as a number of convenience functions. It is also the recommended way for custom Flitter units to expose global variables and functions.

directories

type:  libflitter/utility/DirectoryStore

Provides access to globally-registered Flitter directories - these are provided and used by various units, including custom ones, to access directories that can be changed by the user programmatically.

deployments

type:  libflitter/utility/DeployStore

Provides access to globally-registered Flitter deployments - these are provided and used by various units, including custom ones, to run deployments to set up various units.

templates

type:  libflitter/utility/TemplateStore

Provides access to globally-registered Flitter templates - these are provided and used by various units, including custom ones, to create various types of files to aid application development.

services

type:  Array

A list of service names of type String. If a unit provides a service that other units or the developer are meant to interact with, they should push a service name here. This allows other units and the application to check if a service is provided.

has(String name)

returns:  Boolean

Checks if the given name is in the this.services. This is how other units and the application can check if a given unit has been loaded.

No Comments
Back to top