laxar
The API entry point for boostrapping LaxarJS applications. Also, provides a couple of utilities to deal with assertions, objects and strings.
Contents
Types
Types
laxar
laxar.create( adapters, artifacts, configuration )
Prepares a LaxarJS application instance from a list of adapters, a bundle of artifacts, and application
configuration. The instance then allows to configure which DOM node should receive an application flow.
Running this has no effect until .bootstrap()
is called on the returned instance API.
Parameters
Property | Type | Description |
---|---|---|
adapters | Array |
widget adapters to use in this bootstrapping instance |
artifacts | Object |
an artifact listing for the application, generated by the utilized built tool (e.g. webpack) |
configuration | Object |
application-wide LaxarJS configuration. See http://laxarjs.org/docs/laxar-latest/manuals/configuration/ for further information on available properties |
Returns
Type | Description |
---|---|
BootstrappingInstance |
a handle on the bootstrapping instance, to load and bootstrap a flow |
laxar.instances( optionalName )
Provide tooling access to LaxarJS services.
Each laxar#bootstrap call creates a new set of services such as a logger, global event bus etc. For tools like the laxar-developer-tools-widget, it may be necessary to access these services for a given instance, or for all instances.
Parameters
Property | Type | Description |
---|---|---|
optionalName | String |
the configuration name of a LaxarJS instance to inspect (may be omitted to access all application instances by name) |
Returns
Type | Description |
---|---|
Object |
the tooling services for a specified instance, or for all instances that have tooling enabled |
BootstrappingInstance
Handle on a LaxarJS bootstrapping instance.
BootstrappingInstance.flow( name, anchorElement )
Registers a flow to control routing for this application.
Parameters
Property | Type | Description |
---|---|---|
name | String |
the name of the flow to load |
anchorElement | HTMLElement |
container element to determine where to put the flow |
Returns
Type | Description |
---|---|
BootstrappingInstance |
the current bootstrapping instance (self), for chaining |
BootstrappingInstance.page( name, anchorElement, parameters )
Registers a page to display without navigation control.
Parameters
Property | Type | Description |
---|---|---|
name | String |
the name of the page to load |
anchorElement | HTMLElement |
container element to determine where to put the page |
parameters | Object |
page parameters to publish with didNavigate |
Returns
Type | Description |
---|---|
BootstrappingInstance |
the current bootstrapping instance (self), for chaining |
BootstrappingInstance.tooling( debugInfo )
Registers a debug bundle for this application.
Parameters
Property | Type | Description |
---|---|---|
debugInfo | Function , Object |
the debug-info bundle for the application, generated by the utilized built tool (e.g. webpack) |
Returns
Type | Description |
---|---|
BootstrappingInstance |
the current bootstrapping instance (self), for chaining |
BootstrappingInstance.testing()
Declare that this instance is used for testing. This will cause .bootstrap not to fail if no flow was configured.
Returns
Type | Description |
---|---|
BootstrappingInstance |
the current bootstrapping instance (self), for chaining |
BootstrappingInstance.bootstrap()
Performs the actual application bootstrapping. This includes bootstrapping the application adapters and starting the router.
Returns
Type | Description |
---|---|
Promise |
a promise resolving when all items have been bootstrapped |
ItemMeta
An object of strings which together identify a bootstrapping item.
ItemMeta.instance String
The (topic-formatted) name of the LaxarJS instance.
ItemMeta.item String
The (topic-formatted, ID-suffixed) name of the bootstrapping item.
ItemMeta.type String
The type of the bootstrapping item.
ItemMeta.${type} String
The artifact reference used for creating the bootstrapping item.