Constructor
new CanonicalAccessUnit()
Instantiate the unit.
Extends
Members
(static) name
Get the name of the service provided by this unit: 'canon'
(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.
- boolean
- Overrides:
- Source:
(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.
- Source:
(private) _di_deferred_services :Array.<string>
List of services that were deferred and not provided at the time of injection.
- Array.<string>
- Source:
resources :object
Mapping of canonical item type to resolver function.
- object
Methods
(async) cleanup(app) → {Promise.<void>}
Cleans up the unit's resources before Flitter closes.
Name | Type | Description |
---|---|---|
app |
module:libflitter/app/FlitterApp~FlitterApp | the Flitter app |
- Overrides:
- Source:
- Type
- Promise.<void>
directories() → {Object}
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.
- Overrides:
- Source:
- Type
- Object
get(resource) → {*}
Get a canonical resource by its fully-qualified name. e.g. 'controller::Home.welcome' e.g. 'middleware::Logger' e.g. 'model::auth:User'
Name | Type | Description |
---|---|---|
resource |
string | the fully-qualified canonical resource name |
- the corresponding resource
- Type
- *
(async) go(app, context) → {Promise.<void>}
Loads the unit. This should attach the unit's functionality to the Flitter app. It is provided a context where its variables and methods that need to be made available to the rest of the app should reside.
Name | Type | Description |
---|---|---|
app |
module:libflitter/app/FlitterApp~FlitterApp | the Flitter app |
context |
module:libflitter/Context~Context | the unit's context. This is where variables and methods provided by the unit should be bound. |
- Overrides:
- Source:
- Type
- Promise.<void>
name() → {String}
Get the name of the unit. Should be a lowercase, alphanum/dash/underscore string.
- Overrides:
- Source:
- Type
- String
register_resource(scope, retriever)
Register a canonical resolver under the specified scope.
Name | Type | Description |
---|---|---|
scope |
string | e.g. 'middleware'/'controller'/&c. |
retriever |
function | resolver that takes the unqualified canonical name and returns the resource |
status(setopt) → {string}
Get or set the unit's current status.
Name | Type | Attributes | Description |
---|---|---|---|
set |
string |
<optional> |
if provided, set the status of the unit |
- Overrides:
- Source:
- current status of the unit
- Type
- string