summaryrefslogtreecommitdiff
path: root/op_crates/web/01_event.js
diff options
context:
space:
mode:
Diffstat (limited to 'op_crates/web/01_event.js')
-rw-r--r--op_crates/web/01_event.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/op_crates/web/01_event.js b/op_crates/web/01_event.js
index 48899e6fd..5b21d4402 100644
--- a/op_crates/web/01_event.js
+++ b/op_crates/web/01_event.js
@@ -1011,6 +1011,55 @@
"error",
]);
+ class CloseEvent extends Event {
+ #wasClean = "";
+ #code = "";
+ #reason = "";
+
+ get wasClean() {
+ return this.#wasClean;
+ }
+ get code() {
+ return this.#code;
+ }
+ get reason() {
+ return this.#reason;
+ }
+
+ constructor(type, {
+ bubbles,
+ cancelable,
+ composed,
+ wasClean = false,
+ code = 0,
+ reason = "",
+ } = {}) {
+ super(type, {
+ bubbles: bubbles,
+ cancelable: cancelable,
+ composed: composed,
+ });
+
+ this.#wasClean = wasClean;
+ this.#code = code;
+ this.#reason = reason;
+ }
+ }
+
+ class MessageEvent extends Event {
+ constructor(type, eventInitDict) {
+ super(type, {
+ bubbles: eventInitDict?.bubbles ?? false,
+ cancelable: eventInitDict?.cancelable ?? false,
+ composed: eventInitDict?.composed ?? false,
+ });
+
+ this.data = eventInitDict?.data ?? null;
+ this.origin = eventInitDict?.origin ?? "";
+ this.lastEventId = eventInitDict?.lastEventId ?? "";
+ }
+ }
+
class CustomEvent extends Event {
#detail = null;
@@ -1037,6 +1086,8 @@
window.Event = Event;
window.EventTarget = EventTarget;
window.ErrorEvent = ErrorEvent;
+ window.CloseEvent = CloseEvent;
+ window.MessageEvent = MessageEvent;
window.CustomEvent = CustomEvent;
window.dispatchEvent = EventTarget.prototype.dispatchEvent;
window.addEventListener = EventTarget.prototype.addEventListener;