Skip to content

Module: src/controller/Controller

The controller component mainly acts as a container for other child components. In addition it also reacts to 'ui/show' and 'ui/hide' events which are in turn used to hide and show the controller (and its children).

Version
1.0.0
Author
Frank Kudermann - alphanull
License
MIT
Requires
DomSmith
sortElements
Source
Controller.js, line 14

Constructor

new Controller(player, parent, optionsopt)

Creates an instance of the Controller component.

Parameters:
Name Type Attributes Description
player Player

Reference to the VisionPlayer instance.

parent UI

Reference to the parent instance.

options Object optional

Additional options.

Parameters:
Name Type Attributes Description
apiKey symbol optional

Token for extended access to the player API.

Members

Reference to the main player instance.

Type
Player
Source
Controller.js, line 20

Holds tokens of subscriptions to player events, for later unsubscribe.

Type
Array<number>
Source
Controller.js, line 26

Reference to the DomSmith instance used to manage DOM elements.

Type
DomSmith
Source
Controller.js, line 32

Reference to the root player element.

Type
HTMLElement
Source
Controller.js, line 38

Timeout ID for debounced resize logic.

Type
number
Source
Controller.js, line 44

Methods

private #sortButtons()

Sorts child nodes of a container according to data-sort logic.

Listens
dom/beforemount
Source
Controller.js, line 111

private #show()

As soon as the UI is shown, show the controller as well.

Listens
ui/show
Source
Controller.js, line 123

private #hide()

As soon as the UI is hidden, hide the controller as well.

Listens
ui/hide
Source
Controller.js, line 134

resize()

On resize, update the space the controller blocks at the bottom of the player viewport.

Listens
ui/resize
Source
Controller.js, line 145

getElement(area) → HTMLElement

Used by child components to retrieve a container element they can attach.

Parameters:
Name Type Description
area 'left' | 'center' | 'right'

Which logical area to retrieve.

Returns

A reference to the container DOM node.

Type HTMLElement
Source
Controller.js, line 162

destroy()

This method removes all events, subscriptions and DOM nodes created by this component.

Source
Controller.js, line 171