| 
									
										
										
										
											2021-04-24 13:54:24 +02:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Copyright (c) 2021, Dex♪ <dexes.ttp@gmail.com> | 
					
						
							| 
									
										
										
										
											2022-08-08 22:29:40 +02:00
										 |  |  |  * Copyright (c) 2022, Andreas Kling <kling@serenityos.org> | 
					
						
							| 
									
										
										
										
											2021-04-24 13:54:24 +02:00
										 |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-05 10:33:56 +01:00
										 |  |  | #include <AK/FlyString.h>
 | 
					
						
							| 
									
										
										
										
											2021-04-24 13:54:24 +02:00
										 |  |  | #include <LibWeb/DOM/Event.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Web::HTML { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-01 18:39:03 +03:00
										 |  |  | struct MessageEventInit : public DOM::EventInit { | 
					
						
							|  |  |  |     JS::Value data { JS::js_null() }; | 
					
						
							| 
									
										
										
										
											2023-03-05 10:33:56 +01:00
										 |  |  |     String origin; | 
					
						
							|  |  |  |     String last_event_id; | 
					
						
							| 
									
										
										
										
											2021-10-01 18:39:03 +03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-24 13:54:24 +02:00
										 |  |  | class MessageEvent : public DOM::Event { | 
					
						
							| 
									
										
										
										
											2022-08-28 13:42:07 +02:00
										 |  |  |     WEB_PLATFORM_OBJECT(MessageEvent, DOM::Event); | 
					
						
							| 
									
										
										
										
											2022-08-08 22:29:40 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-24 13:54:24 +02:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2023-03-05 10:33:56 +01:00
										 |  |  |     static WebIDL::ExceptionOr<JS::NonnullGCPtr<MessageEvent>> create(JS::Realm&, FlyString const& event_name, MessageEventInit const& event_init = {}); | 
					
						
							|  |  |  |     static WebIDL::ExceptionOr<JS::NonnullGCPtr<MessageEvent>> construct_impl(JS::Realm&, FlyString const& event_name, MessageEventInit const& event_init); | 
					
						
							| 
									
										
										
										
											2021-04-24 13:54:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-05 10:33:56 +01:00
										 |  |  |     MessageEvent(JS::Realm&, FlyString const& event_name, MessageEventInit const& event_init); | 
					
						
							| 
									
										
										
										
											2022-08-08 22:29:40 +02:00
										 |  |  |     virtual ~MessageEvent() override; | 
					
						
							| 
									
										
										
										
											2021-04-24 13:54:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-08 22:29:40 +02:00
										 |  |  |     JS::Value data() const { return m_data; } | 
					
						
							| 
									
										
										
										
											2023-03-05 10:33:56 +01:00
										 |  |  |     String const& origin() const { return m_origin; } | 
					
						
							|  |  |  |     String const& last_event_id() const { return m_last_event_id; } | 
					
						
							| 
									
										
										
										
											2021-04-24 13:54:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-08 22:29:40 +02:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2023-01-28 12:33:35 -05:00
										 |  |  |     virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; | 
					
						
							| 
									
										
										
										
											2022-08-08 22:29:40 +02:00
										 |  |  |     virtual void visit_edges(Cell::Visitor&) override; | 
					
						
							| 
									
										
										
										
											2021-04-24 13:54:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-08 22:29:40 +02:00
										 |  |  |     JS::Value m_data; | 
					
						
							| 
									
										
										
										
											2023-03-05 10:33:56 +01:00
										 |  |  |     String m_origin; | 
					
						
							|  |  |  |     String m_last_event_id; | 
					
						
							| 
									
										
										
										
											2021-04-24 13:54:24 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |