akamai.amp~Plugin
The plugin base class.
Constructor
Plugin
new Plugin(player, config, key)
Create a Plugin
Parameters
Name | Type | Description |
---|---|---|
player |
Player | The player instance. |
config |
Object | The plugin's config. |
key |
string | The key used to register the plugin |
Extends
Members
data
(readonly) :Object
The plugin's configuration object with all data bindings evaluated.
debug
(readonly) :boolean
Flag indicating whether or not the plugin is in debug mode.
locales
(readonly) :Object|Array.<Object>
A localization object or list of localization objects. When an array is provided objects later in the list will override earlier ones.
Example
var locales = [
{en: {MSG_TEST: "testing"}},
{en: {MSG_TEST: "123"}},
]
console.log(amp.getLocalizedString("MSG_TEST"))
// -> "123"
Methods
createFactory
(static) createFactory(def) → {function}
Create a factory function from a Plugin class
Parameters
Name | Type | Description |
---|---|---|
def |
Class | The plugin class. |
Returns
- function
-
The factory function.
addEventListener
addEventListener(typenon-null, funcnon-null)
Adds a listener for a given event type.
Parameters
Name | Type | Description |
---|---|---|
type |
string | A string representing the event's type. |
func |
function | A function to call when the event is triggered. |
- Overrides:
addListener
addListener()
Alias of addEventListener
- Overrides:
dispatch
dispatch(type, detailopt)
Dispathes and event, triggering all event listener of the event's type.
Parameters
Name | Type | Attributes | Description |
---|---|---|---|
type |
string | The event to type. |
|
detail |
Object |
<optional> |
Object representing event specific details. |
- Overrides:
dispatchEvent
dispatchEvent(eventnon-null)
Dispathes and event, triggering all event listener of the event's type.
Parameters
Name | Type | Description |
---|---|---|
event |
Event | The event to dispatch. |
- Overrides:
once
once(typenon-null, funcnon-null)
Adds a listener for a given event type that is called once, then removed.
Parameters
Name | Type | Description |
---|---|---|
type |
string | A string representing the event's type. |
func |
function | A function to call when the event is triggered. |
- Overrides:
removeEventListener
removeEventListener(typenon-null, funcnon-null) → (nullable) {function}
Removes a listener for a given event type.
Parameters
Name | Type | Description |
---|---|---|
type |
string | A string representing the event's type. |
func |
function | A function to call when the event is triggered. |
Returns
- function
-
the handler that was removed if any
removeListener
removeListener()
Alias of removeEventListener
- Overrides: