@interactjs/core/BaseEvent.ts

import Interactable from './Interactable'

export class BaseEvent<T extends Interact.ActionName = any> {
  type: string
  target: EventTarget
  currentTarget: EventTarget
  interactable: Interactable
  _interaction: Interact.Interaction<T>
  timeStamp: any
  immediatePropagationStopped = false
  propagationStopped = false

  get interaction () {
    return this._interaction._proxy
  }

  constructor (interaction: Interact.Interaction) {
    this._interaction = interaction
  }

  preventDefault () {}

  /**
   * Don't call any other listeners (even on the current target)
   */
  stopPropagation () {
    this.propagationStopped = true
  }

  /**
   * Don't call listeners on the remaining targets
   */
  stopImmediatePropagation () {
    this.immediatePropagationStopped = this.propagationStopped = true
  }
}

export default BaseEvent