Constructor
new Popup(player, parent, optionsopt)
Creates an instance of the Popup component.
| Name | Type | Attributes | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
player |
Player |
Reference to the player instance. |
|||||||||
parent |
Controller |
Reference to the parent instance, in this case the controller. |
|||||||||
options |
Popup~PopupConfig | optional |
Additional configuration for the popup (defined at build time).
|
Members
private #player :Player
private #subscriptions :Array<number>
Holds tokens of subscriptions to player events, for later unsubscribe.
private #apiKey :symbol
Secret key only known to the player instance and initialized components. Used to be able to restrict access to API methods in conjunction with secure mode.
private #icon :DomSmith
A DomSmith instance to create a button in the controller or parent container. This button is initially hidden until we detect content inside the popup.
private #popup :PopupWrapper
Reference to the popup instance.
- Type
- PopupWrapper
- Source
- Popup.js, line 58
private #popupContent :DomSmith
A DomSmith used as the content container within the popup. Child components (AirPlay, Quality, etc.) attach their UI here.
private #mutationObserver :MutationObserver
MutationObserver that reveals the popup button once content is added to the popup container. Also tracks deletions of content nodes and automatically disables or hides the popup when no content is present.
private #hideNoContent :boolean
If true
, popup icon is completely hidden instead of greyed our when popup content is empty.
Methods
private #onMutation(mutationList)
Called by the mutation observer when popup content changes. Hides or disables the popup icon if no content is present.
| Name | Type | Description |
|---|---|---|
mutationList |
Array |
[description]. |
showPopup(event)
Shows the popup when the user clicks the associated button.
| Name | Type | Description |
|---|---|---|
event |
Event |
The DOM event that triggered this method. |
hidePopup()
Hides the popup, either because the UI hides or the user clicks away from the popup.
refreshPopup()
Refreshes Popup (recalculates layout) on media/ready if open. May be necessary because child components might alter popup content. This handler is invoked with a very low priority to ensure it comes last.
- Listens
- media/ready
- Source
- Popup.js, line 208
getElement(area) → HTMLElement
Provides container elements for child components that want to attach content to this popup. "top", "center", and "bottom" can be used for layout areas, or fallback to the root wrapper.
| Name | Type | Description |
|---|---|---|
area |
string |
The desired area: "top", "center", "bottom". |
destroy()
This method removes all events, subscriptions and DOM nodes created by this component.
Type Definitions
PopupConfig
Configuration options for the Popup Component. Those options are set at build time, not runtime by adding them to the "addComponent" function.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
buttonClass
|
string | optional | CSS class(es) for the popup button in the controller. |
|
label
|
string | optional | Translate Path for the accessible label text for the button. |
|
attach
|
string | optional | Where to attach the button in the parent's container (e.g., "right", "top", etc.). |
|
viewClass
|
string | optional | "" | Additional CSS class to apply to the popup container. |
hideNoContent
|
string | optional | false | If |
Example
Player.addComponent("ui.controller.popupControls", Popup, { buttonClass: "icon control", viewClass: "vip-control-popup", label: "components.pictureControls.header", attach: "right" });