OpenTV Player Web HTML5

Mixin: EventedMixin

evented~ EventedMixin

Contains methods that provide event capabilities to an object which is passed to evented.

Methods

staticmodule:evented~EventedMixin.any(targetOrType, typeOrListener, listener)

Add a listener to an event (or events) on this object or another evented object. The listener will only be called once for the first event that is triggered then removed.

Name Type Description
targetOrType string | Array | Element | Object

If this is a string or array, it represents the event type(s) that will trigger the listener.

    Another evented object can be passed here instead, which will
    cause the listener to listen for events on _that_ object.

    In either case, the listener's `this` value will be bound to
    this object.
typeOrListener string | Array | function

If the first argument was a string or array, this should be the listener function. Otherwise, this is a string or array of event type(s).

listener function optional

If the first argument was another evented object, this will be the listener function.

staticmodule:evented~EventedMixin.off(targetOrType, typeOrListener, listener)

Removes listener(s) from event(s) on an evented object.

Name Type Description
targetOrType string | Array | Element | Object optional

If this is a string or array, it represents the event type(s).

    Another evented object can be passed here instead, in which case
    ALL 3 arguments are _required_.
typeOrListener string | Array | function optional

If the first argument was a string or array, this may be the listener function. Otherwise, this is a string or array of event type(s).

listener function optional

If the first argument was another evented object, this will be the listener function; otherwise, all listeners bound to the event type(s) will be removed.

staticmodule:evented~EventedMixin.on(targetOrType, typeOrListener, listener)

Add a listener to an event (or events) on this object or another evented object.

Name Type Description
targetOrType string | Array | Element | Object

If this is a string or array, it represents the event type(s) that will trigger the listener.

    Another evented object can be passed here instead, which will
    cause the listener to listen for events on _that_ object.

    In either case, the listener's `this` value will be bound to
    this object.
typeOrListener string | Array | function

If the first argument was a string or array, this should be the listener function. Otherwise, this is a string or array of event type(s).

listener function optional

If the first argument was another evented object, this will be the listener function.

staticmodule:evented~EventedMixin.one(targetOrType, typeOrListener, listener)

Add a listener to an event (or events) on this object or another evented object. The listener will be called once per event and then removed.

Name Type Description
targetOrType string | Array | Element | Object

If this is a string or array, it represents the event type(s) that will trigger the listener.

    Another evented object can be passed here instead, which will
    cause the listener to listen for events on _that_ object.

    In either case, the listener's `this` value will be bound to
    this object.
typeOrListener string | Array | function

If the first argument was a string or array, this should be the listener function. Otherwise, this is a string or array of event type(s).

listener function optional

If the first argument was another evented object, this will be the listener function.

staticmodule:evented~EventedMixin.trigger(event, hash){boolean}

Fire an event on this evented object, causing its listeners to be called.

Name Type Description
event string | Object

An event type or an object with a type property.

hash Object optional

An additional object to pass along to listeners.

Returns:
Type Description
boolean Whether or not the default behavior was prevented.