HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/zaklada/html/node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js
"use strict";

const conversions = require("webidl-conversions");
const utils = require("./utils.js");
const Impl = require("../events/EventTarget-impl.js");

const impl = utils.implSymbol;

function EventTarget() {
  throw new TypeError("Illegal constructor");
}

EventTarget.prototype.addEventListener = function addEventListener(type, callback) {
  if (!this || !(this[impl] instanceof Impl.implementation)) {
    throw new TypeError("Illegal invocation");
  }
  if (arguments.length < 2) {
    throw new TypeError("Failed to execute 'addEventListener' on 'EventTarget': 2 arguments required, but only " + arguments.length + " present.");
  }
  const args = [];
  for (let i = 0; i < arguments.length && i < 3; ++i) {
    args[i] = arguments[i];
  }
  args[0] = conversions["DOMString"](args[0]);
  if (args[2] !== undefined) {
  args[2] = conversions["boolean"](args[2]);
  }
  return this[impl].addEventListener.apply(this[impl], args);
};

EventTarget.prototype.removeEventListener = function removeEventListener(type, callback) {
  if (!this || !(this[impl] instanceof Impl.implementation)) {
    throw new TypeError("Illegal invocation");
  }
  if (arguments.length < 2) {
    throw new TypeError("Failed to execute 'removeEventListener' on 'EventTarget': 2 arguments required, but only " + arguments.length + " present.");
  }
  const args = [];
  for (let i = 0; i < arguments.length && i < 3; ++i) {
    args[i] = arguments[i];
  }
  args[0] = conversions["DOMString"](args[0]);
  if (args[2] !== undefined) {
  args[2] = conversions["boolean"](args[2]);
  }
  return this[impl].removeEventListener.apply(this[impl], args);
};

EventTarget.prototype.dispatchEvent = function dispatchEvent(event) {
  if (!this || !(this[impl] instanceof Impl.implementation)) {
    throw new TypeError("Illegal invocation");
  }
  if (arguments.length < 1) {
    throw new TypeError("Failed to execute 'dispatchEvent' on 'EventTarget': 1 argument required, but only " + arguments.length + " present.");
  }
  const args = [];
  for (let i = 0; i < arguments.length && i < 1; ++i) {
    args[i] = arguments[i];
  }
  return this[impl].dispatchEvent.apply(this[impl], args);
};

module.exports = {
  create(constructorArgs, privateData) {
    let obj = Object.create(EventTarget.prototype);
    this.setup(obj, constructorArgs, privateData);
    return obj;
  },
  setup(obj, constructorArgs, privateData) {
    if (!privateData) privateData = {};
    privateData.wrapper = obj;

    obj[impl] = new Impl.implementation(constructorArgs, privateData);
    obj[impl][utils.wrapperSymbol] = obj;
  },
  interface: EventTarget,
  expose: {
    Window: { EventTarget: EventTarget },
    Worker: { EventTarget: EventTarget }
  }
};