1.0.58 • Published 2 years ago

@humany/widget-types-floating v1.0.58

Weekly downloads
50
License
SEE LICENSE IN LI...
Repository
-
Last release
2 years ago

Humany Floating widget

The Floating widget consists of a trigger element (triggerDOMElement) and a main widget element (widgetDOMElement).

General commands

The following commands are part of the Webprovisions widget definition and are available for all widget types.

initialize(): Promise

No custom behaviour.

activate([options: BotWidgetActivationOptions]): Promise

Creates new instances of triggerDOMElement and widgetDOMElement. The triggerDOMElement is directly appended to the DOM whereas the widgetDOMElement is not appended until later.

After activation, the elements are available on the Container:

const widgetDOMElement = container.get('widgetDOMElement');
const triggerDOMElement = container.get('triggerDOMElement');

destroy(): Promise

Invokes moveOutsideViewport() and then removes widgetDOMElement and triggerDOMElement.

Widget commands

Regular commands can be invoked after the widget has been activated.

navigate(commands: { route: string, params?: { [key: string]: any }}): void

Navigates the widget to specified route with optional params.

moveInsideViewport(): void

Positions the widgetDOMElement inside the viewport relative to the triggerDOMElement. Together with CSS transitions this will create an animation where the widget is sliding in.

moveOutsideViewport(): void

Positions the widgetDOMElement outside the viewport relative to the triggerDOMElement. Together with CSS transitions this will create an animation where the widget is sliding out.

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 service is registered when a Floating widget is created.

Accessing the controller from a Plugin

The widget controller is available on initialize() (but not in the constructor). When extending from the Webprovisions.Platform.Plugin class, the controller is accessible on this.controller. Use the invoke() function to invoke commands on the widget API:

import { Plugin } from '@humany/widget-core';

class MyPlugin extends Plugin {
  initialize() {
    this.controller.invoke('[commandName]');
  }
}

See the Skeleton Plugin repository for an example on how to author a Webprovisions plugin.

1.0.58

2 years ago

1.0.57

2 years ago

1.0.56

2 years ago

1.0.55

2 years ago

1.0.54

2 years ago

1.0.53

2 years ago

1.0.52

2 years ago

1.0.48

2 years ago

1.0.49

2 years ago

1.0.51

2 years ago

1.0.50

2 years ago

1.0.47

3 years ago

1.0.46

3 years ago

1.0.45

3 years ago

1.0.44

3 years ago

1.0.43

3 years ago

1.0.42

3 years ago

1.0.41

4 years ago

1.0.40

4 years ago

1.0.40-beta.0

4 years ago

1.0.39

4 years ago

1.0.38

4 years ago

1.0.37

4 years ago

1.0.36

4 years ago

1.0.35

4 years ago

1.0.34

4 years ago

1.0.33

4 years ago

1.0.32

4 years ago

1.0.31

4 years ago

1.0.30

4 years ago

1.0.29

4 years ago

1.0.28

4 years ago

1.0.27

4 years ago

1.0.26

4 years ago

1.0.25

4 years ago

1.0.24

4 years ago

1.0.22

4 years ago

1.0.23

4 years ago

1.0.21

5 years ago

1.0.20

5 years ago

1.0.19

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.14

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

1.0.0-beta.25

5 years ago

1.0.0-beta.24

6 years ago

1.0.0-beta.23

6 years ago

1.0.0-beta.22

6 years ago

1.0.0-beta.21

6 years ago

1.0.0-beta.20

6 years ago

1.0.0-beta.19

6 years ago

1.0.0-beta.18

6 years ago

1.0.0-beta.17

6 years ago

1.0.0-beta.14

6 years ago