2020-05-11 08:28:13 -04:00
|
|
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
|
|
|
|
|
|
|
import { EventImpl as Event } from "./event.ts";
|
|
|
|
import { defineEnumerableProps } from "./util.ts";
|
|
|
|
|
|
|
|
export class ErrorEventImpl extends Event implements ErrorEvent {
|
2020-07-06 21:45:39 -04:00
|
|
|
readonly #message: string;
|
|
|
|
readonly #filename: string;
|
|
|
|
readonly #lineno: number;
|
|
|
|
readonly #colno: number;
|
2020-05-11 08:28:13 -04:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
2020-07-06 21:45:39 -04:00
|
|
|
readonly #error: any;
|
2020-05-11 08:28:13 -04:00
|
|
|
|
|
|
|
get message(): string {
|
|
|
|
return this.#message;
|
|
|
|
}
|
|
|
|
get filename(): string {
|
|
|
|
return this.#filename;
|
|
|
|
}
|
|
|
|
get lineno(): number {
|
|
|
|
return this.#lineno;
|
|
|
|
}
|
|
|
|
get colno(): number {
|
|
|
|
return this.#colno;
|
|
|
|
}
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
|
|
get error(): any {
|
|
|
|
return this.#error;
|
|
|
|
}
|
|
|
|
|
|
|
|
constructor(
|
|
|
|
type: string,
|
|
|
|
{
|
|
|
|
bubbles,
|
|
|
|
cancelable,
|
|
|
|
composed,
|
|
|
|
message = "",
|
|
|
|
filename = "",
|
|
|
|
lineno = 0,
|
|
|
|
colno = 0,
|
|
|
|
error = null,
|
2020-07-14 15:24:17 -04:00
|
|
|
}: ErrorEventInit = {},
|
2020-05-11 08:28:13 -04:00
|
|
|
) {
|
|
|
|
super(type, {
|
|
|
|
bubbles: bubbles,
|
|
|
|
cancelable: cancelable,
|
|
|
|
composed: composed,
|
|
|
|
});
|
|
|
|
|
|
|
|
this.#message = message;
|
|
|
|
this.#filename = filename;
|
|
|
|
this.#lineno = lineno;
|
|
|
|
this.#colno = colno;
|
|
|
|
this.#error = error;
|
|
|
|
}
|
|
|
|
|
|
|
|
get [Symbol.toStringTag](): string {
|
|
|
|
return "ErrorEvent";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
defineEnumerableProps(ErrorEventImpl, [
|
|
|
|
"message",
|
|
|
|
"filename",
|
|
|
|
"lineno",
|
|
|
|
"colno",
|
|
|
|
"error",
|
|
|
|
]);
|