Constructor
new FormsUnit(base_directoryopt)
Instantiate the unit.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
base_directory |
string |
<optional> |
'./app/forms' | the base directory to search for form definitions |
- Source:
Extends
Members
(static) name
Get the name of the service provided by this unit: 'forms'
- Source:
(static) services
Defines the services required by this unit.
- Source:
(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
- 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:
canonical_item :string
Name of the canonical item provided by this unit: 'form'
- string
- Source:
canonical_items :object
Mapping of canonical names to instances for this item.
- object
- Source:
directory :Promise.<void>|Promise.<string>
The root directory for this canonical resource's files.
- Promise.<void> | Promise.<string>
- Source:
suffix :string
File extension of the canonical item provided by this unit: '.form.js'
- string
- Source:
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 |
- Source:
- Type
- Promise.<void>
(async) deploy() → {Promise.<void>}
Deploy the sample files provided by this unit. Creates the "app/validators" directory and an example validator schema.
- Source:
- Type
- Promise.<void>
directories() → {object}
Get the directories provided by this unit.
- Type
- object
get(name) → {object}
Resolve an unqualified canonical name to a registered canonical item.
Name | Type | Description |
---|---|---|
name |
string |
- Type
- object
(async) go(app) → {Promise.<void>}
Initializes the unit. Loads the form validator definitions from the configured directory.
Name | Type | Description |
---|---|---|
app |
module:libflitter/app/FlitterApp~FlitterApp | the Flitter app |
- Source:
- Type
- Promise.<void>
init(validator, request)
Initialize a form for the specified validator into the request's session.
Name | Type | Description |
---|---|---|
validator |
module:flitter-forms/Validator~Validator | |
request |
express/request |
- Source:
(async) init_canonical_file(info, instance) → {Promise.<module:flitter-forms/Validator~Validator>}
Init a single instance of the validator from the canonical info.
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
info |
object |
Properties
|
|||||||||
instance |
object | validator schema definition |
- Source:
- Type
- Promise.<module:flitter-forms/Validator~Validator>
name() → {String}
Get the name of the unit. Should be a lowercase, alphanum/dash/underscore string.
- Source:
- Type
- String
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 |
- Source:
- current status of the unit
- Type
- string
templates() → {Object}
Get the templates provided by this unit.
- Source:
- Type
- Object