"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const event = require("../common/event.js");
class DomEmitter {
  constructor(element, type, useCapture) {
    const fn = (e) => this.emitter.fire(e);
    this.emitter = new event.Emitter({
      onFirstListenerAdd: () => element.addEventListener(type, fn, useCapture),
      onLastListenerRemove: () => element.removeEventListener(type, fn, useCapture)
    });
  }
  get event() {
    return this.emitter.event;
  }
  dispose() {
    this.emitter.dispose();
  }
}
function stopEvent(event2) {
  event2.preventDefault();
  event2.stopPropagation();
  return event2;
}
exports.DomEmitter = DomEmitter;
exports.stopEvent = stopEvent;
