Techdocs

AMP Web SDK

AMP player

akamai.amp~Timer

The TimerGroup class.

Constructor

Timer

new Timer(delay, repeatCount)

Creates a Timer.

Parameters
Name Type Description
delay number

The delay in milliseconds

repeatCount number

The the number of times the timer "ticks" or repeats

Extends

Methods

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:

destroy

destroy()

Destroys the Timer

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:

emit

emit()

Alias of dispatch

Overrides:

off

off()

Alias of removeEventListener

Overrides:

on

on()

Alias of addEventListener

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.

Overrides:
Returns
function

the handler that was removed if any

removeListener

removeListener()

Alias of removeEventListener

Overrides:

reset

reset()

Resets the Timer

start

start()

Starts the timer

stop

stop()

Stops the Timer