@humany/widget-types-inline
v1.0.50
Published
Type definition for Humany Inline widget.
Downloads
132
Keywords
Readme
Humany Inline Widget
General commands
The following commands are part of the Webprovisions widget definition and are available for all widget types.
initialize(): Promise
Gets the widget config from the ServiceClient
and maps it to $settings
on the Container
.
Creates and registers a new TextManager
on the Container
.
Finally removes any found triggerElements
.
activate(widgetActivationOptions?: { widgetDOMElement?: HTMLElement }): Promise
Uses the passed widgetDOMElement
or creates new widgetDOMElement
, appends to document.body
and adds it to the Container
.
Initializes the widget router.
Connects the widget data source.
Finally renders the widget inside the widgetDOMElement
.
deactivate(): Promise
Deactivates the widget router and removes the widgetDOMElement
from the DOM.
Services
Both asynchronous and synchronous services are available on the Container
:
Async services:
// ES stage 3 syntax
const theService = await container.getAsync('theService');
// ES6 syntax
container.getAsync('theService').then((theService) => {
});
Sync services:
const theService = container.get('theService');
The following services are registered when an Inline widget is created.
data: DataSource
: Data source containing a stream of entries used to display data.writer: DataWriter
: Writer used to write and/or update entries on the data source.router: RoutingService
: Router used to handle routing.storage: StorageProvider
: Storage service used to store things in the browser, i.e cookies, session and local storage.matchingClient: ServiceClient
: Simple HTTP-client used to get data from the Humany Service.texts: TextManager
: Simple handler for localized and translated texts.