summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/MessageEvent.h
diff options
context:
space:
mode:
authorDexesTTP <dexes.ttp@gmail.com>2021-04-24 13:54:24 +0200
committerLinus Groh <mail@linusgroh.de>2021-04-25 19:04:34 +0200
commit22413ef729ffe995c5ef3a9f8fb69567ed913980 (patch)
tree5c8c539ea68d32b18d3db961a2912879e8361d03 /Userland/Libraries/LibWeb/HTML/MessageEvent.h
parent68bfb46a6fef9aa1b6617382ae4cf10042658e26 (diff)
downloadserenity-22413ef729ffe995c5ef3a9f8fb69567ed913980.zip
LibWeb: Add WebSocket bindings
The WebSocket bindings match the original specification from the WHATWG living standard, but do not match the later update of the standard that involves FETCH. The FETCH update will be handled later since the changes would also affect XMLHttpRequest.
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/MessageEvent.h')
-rw-r--r--Userland/Libraries/LibWeb/HTML/MessageEvent.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/MessageEvent.h b/Userland/Libraries/LibWeb/HTML/MessageEvent.h
new file mode 100644
index 0000000000..5fa92bcf4e
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/MessageEvent.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2021, Dexβ™ͺ <dexes.ttp@gmail.com>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <LibWeb/DOM/Event.h>
+
+namespace Web::HTML {
+
+class MessageEvent : public DOM::Event {
+public:
+ using WrapperType = Bindings::MessageEventWrapper;
+
+ static NonnullRefPtr<MessageEvent> create(const FlyString& event_name, const String& data, const String& origin)
+ {
+ return adopt_ref(*new MessageEvent(event_name, data, origin));
+ }
+
+ virtual ~MessageEvent() override = default;
+
+ const String& data() const { return m_data; }
+ const String& origin() const { return m_origin; }
+
+protected:
+ MessageEvent(const FlyString& event_name, const String& data, const String& origin)
+ : DOM::Event(event_name)
+ , m_data(data)
+ , m_origin(origin)
+ {
+ }
+
+ String m_data;
+ String m_origin;
+};
+
+}