JSPM

  • Created
  • Published
  • Downloads 31
  • Score
    100M100P100Q61166F
  • License SEE LICENSE IN LICENSE.txt

Type definition for Humany Inline widget.

Package Exports

  • @humany/widget-types-inline

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@humany/widget-types-inline) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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.