# all files / ol/events/ event.js

100% Statements 11/11
100% Branches 0/0
100% Functions 4/4
100% Lines 11/11

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    751×

    1×

    72905×

    72905×

    72905×

    1×

    36×

    1×
    1×

    1×
    1×

     goog.provide('ol.events.Event');

    /**
     * @classdesc
     * Stripped down implementation of the W3C DOM Level 2 Event interface.
     * @see {@link https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-interface}
     *
     * This implementation only provides `type` and `target` properties, and
     * `stopPropagation` and `preventDefault` methods. It is meant as base class
     * for higher level events defined in the library, and works with
     * {@link ol.events.EventTarget}.
     *
     * @constructor
     * @implements {oli.events.Event}
     * @param {string} type Type.
     */
    ol.events.Event = function(type) {

      /**
       * @type {boolean}
       */
      this.propagationStopped;

      /**
       * The event type.
       * @type {string}
       * @api
       */
      this.type = type;

      /**
       * The event target.
       * @type {Object}
       * @api
       */
      this.target = null;

    };

    /**
     * Stop event propagation.
     * @function
     * @override
     * @api
     */
    ol.events.Event.prototype.preventDefault =

      /**
       * Stop event propagation.
       * @function
       * @override
       * @api
       */
      ol.events.Event.prototype.stopPropagation = function() {
        this.propagationStopped = true;
      };

    /**
     * @param {Event|ol.events.Event} evt Event
     */
    ol.events.Event.stopPropagation = function(evt) {
      evt.stopPropagation();
    };

    /**
     * @param {Event|ol.events.Event} evt Event
     */
    ol.events.Event.preventDefault = function(evt) {
      evt.preventDefault();
    };