evented~EventedMixin

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

Methods

static off(targetOrTypeopt, typeOrListeneropt, listeneropt)

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

Parameters:
Name Type Attributes 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.

static on(targetOrType, typeOrListener, listeneropt)

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

Parameters:
Name Type Attributes 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.

static one(targetOrType, typeOrListener, listeneropt)

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

Parameters:
Name Type Attributes 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.

static trigger(event, hashopt) → {boolean}

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

Parameters:
Name Type Attributes 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:
boolean -

Whether or not the default behavior was prevented.