mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +00:00
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.
This commit is contained in:
39
Userland/Libraries/LibWeb/HTML/MessageEvent.h
Normal file
39
Userland/Libraries/LibWeb/HTML/MessageEvent.h
Normal file
@@ -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;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user