@interactjs/core/BaseEvent.ts

import Interactable from './Interactable'
import { ActionName } from './scope'

export enum EventPhase {
  Start = 'start',
  Move = 'move',
  End = 'end',
  _NONE = '',
}

export class BaseEvent<T extends 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