Event

Extends IEvent.

Event. Provides methods for accessing the originalObject object's fields and methods, with the possibility for redefining them.

Constructor | Methods

Constructor

Event(originalEvent[, sourceEvent])

Creates an event.

Parameters:

Parameter

Default value

Description

originalEvent*

Type: Object

Source data.

sourceEvent

Type: IEvent

Source event.

* Mandatory parameter/option.

Methods

Name

Returns

Description

allowMapEvent()

Allows the propagation of the event to the map.

Inherited from IEvent.

callMethod(name)

Object

Calls the specified method. The operation is equivalent to searching fields via "get" and making a call that passes originalEvent as context. All arguments after the first one are passed as parameters to the method being called.

get(name)

Object

Returns the field value from originalEvent. originalEvent always has the following fields:

  • type - String event type.
  • target - Reference to the object that generated the event.

getSourceEvent()

IEvent|null

Returns source event.

Inherited from IEvent.

isDefaultPrevented()

Boolean

Checks whether the default reaction to the event is canceled in the Yandex Maps API event system.

isImmediatePropagationStopped()

Boolean

Checks whether event propagation is stopped in the Yandex Maps API event system.

isMapEventAllowed()

Boolean

Returns true if the map event is enabled.

Inherited from IEvent.

isPropagationStopped()

Boolean

Checks whether event propagation up the hierarchy of objects and collections is stopped in the Yandex Maps API event system.

preventDefault()

Cancels the default reaction to an event within the Yandex Maps API event system. Calling this method does not affect propagation of the DOM source event (if there is one) through the DOM tree.

stopImmediatePropagation()

Stops event propagation in the Yandex Maps API event system. Calling this method does not affect propagation of the DOM source event (if there is one) through the DOM tree.

stopPropagation()

Stops event propagation up the hierarchy of objects and collections in the Yandex Maps API event system. Calling this method does not affect propagation of the DOM source event (if there is one) through the DOM tree.

Methods details

callMethod

{Object} callMethod(name)

Calls the specified method. The operation is equivalent to searching fields via "get" and making a call that passes originalEvent as context. All arguments after the first one are passed as parameters to the method being called.

Returns value.

Parameters:

Parameter

Default value

Description

name*

Type: String

Method name.

* Mandatory parameter/option.

get

{Object} get(name)

Returns the field value from originalEvent. originalEvent always has the following fields:

  • type - String event type.
  • target - Reference to the object that generated the event.

Parameters:

Parameter

Default value

Description

name*

Type: String

Property name.

* Mandatory parameter/option.

Example:

// Synchronizing two objects with each other.
object1.events.add(["add", "remove"], function (event) {
    object2[event.get("type")](event.get("child"));
});

isDefaultPrevented

{Boolean} isDefaultPrevented()

Checks whether the default reaction to the event is canceled in the Yandex Maps API event system.

Returns true if the default reaction to the event is canceled, otherwise false.

isImmediatePropagationStopped

{Boolean} isImmediatePropagationStopped()

Checks whether event propagation is stopped in the Yandex Maps API event system.

Returns true if propagation was stopped, or false if not.

isPropagationStopped

{Boolean} isPropagationStopped()

Checks whether event propagation up the hierarchy of objects and collections is stopped in the Yandex Maps API event system.

Returns true if propagation up the hierarchy is canceled; otherwise, false.

preventDefault

{} preventDefault()

Cancels the default reaction to an event within the Yandex Maps API event system. Calling this method does not affect propagation of the DOM source event (if there is one) through the DOM tree.

stopImmediatePropagation

{} stopImmediatePropagation()

Stops event propagation in the Yandex Maps API event system. Calling this method does not affect propagation of the DOM source event (if there is one) through the DOM tree.

stopPropagation

{} stopPropagation()

Stops event propagation up the hierarchy of objects and collections in the Yandex Maps API event system. Calling this method does not affect propagation of the DOM source event (if there is one) through the DOM tree.