AnyChart
API Reference
Still have questions?
Contact support
Top
You are looking at an outdated 7.4.0 version of this document. Switch to the 8.4.0 version to see the up to date information.

class anychart.core.Base Improve this Doc

Extends: goog.events.EventTarget

Class implements all the work with consistency states. invalidate() and markConsistent() are used to change states. isConsistent() and hasInvalidationState() are used to check states.

Methods Overview

Miscellaneous
listen()Adds an event listener to an implementing object.
listenOnce()Adds an event listener to an implementing object.
removeAllListeners()Removes all listeners from an object. You can also optionally remove listeners of some particular type.
unlisten()Removes a listener added using listen() or listenOnce() methods.
unlistenByKey()Removes an event listener which was added with listen() by the key returned by listen() or listenOnce().

Methods Description

listen

Adds an event listener to an implementing object.
The listener can be added to an object once, and if it is added one more time, its key will be returned.
Note Notice that if the existing listener is one-off (added using listenOnce), it will cease to be such after calling the listen() method.

Params:

NameTypeDescription
typestring | !goog.events.EventId.<EVENTOBJ>The event type id.
listenerfunctionCallback method.
useCapturebooleanWhether to fire in capture phase (defaults to false).
listenerScopeSCOPEObject in whose scope to call the listener.

Returns:

goog.events.ListenableKey - Unique key for the listener.

listenOnce

Adds an event listener to an implementing object.
After the event is called, its handler will be deleted.
If the event handler being added already exists, listenOnce will do nothing.
Note In particular, if the handler is already registered using listen(), listenOnce() will not make it one-off. Similarly, if a one-off listener already exists, listenOnce will not change it (it wil remain one-off).

Params:

NameTypeDescription
typestring | !goog.events.EventId.<EVENTOBJ>The event type id.
listenerfunctionCallback method.
useCapturebooleanWhether to fire in capture phase (defaults to false).
listenerScopeSCOPEObject in whose scope to call the listener.

Returns:

goog.events.ListenableKey - Unique key for the listener.

removeAllListeners

Removes all listeners from an object. You can also optionally remove listeners of some particular type.

Params:

NameTypeDescription
typestringType of event to remove, default is to remove all types.

Returns:

number - Number of listeners removed.

unlisten

Removes a listener added using listen() or listenOnce() methods.

Params:

NameTypeDescription
typestring | !goog.events.EventId.<EVENTOBJ>The event type id.
listenerfunctionCallback method.
useCapturebooleanWhether to fire in capture phase (defaults to false).
listenerScopeSCOPEObject in whose scope to call the listener.

Returns:

boolean - Whether any listener was removed.

unlistenByKey

Removes an event listener which was added with listen() by the key returned by listen() or listenOnce().

Params:

NameTypeDescription
keygoog.events.ListenableKeyThe key returned by listen() or listenOnce().

Returns:

boolean - Whether any listener was removed.