| 
									
										
										
										
											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 09:54:17 +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:16:12 +03:00
										 |  |  | struct CloseEventInit : public DOM::EventInit { | 
					
						
							|  |  |  |     bool was_clean { false }; | 
					
						
							|  |  |  |     u16 code { 0 }; | 
					
						
							| 
									
										
										
										
											2023-03-05 09:54:17 +01:00
										 |  |  |     String reason; | 
					
						
							| 
									
										
										
										
											2021-10-01 18:16:12 +03:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-24 13:54:24 +02:00
										 |  |  | class CloseEvent : public DOM::Event { | 
					
						
							| 
									
										
										
										
											2022-08-28 13:42:07 +02:00
										 |  |  |     WEB_PLATFORM_OBJECT(CloseEvent, DOM::Event); | 
					
						
							| 
									
										
										
										
											2022-08-08 22:29:40 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-24 13:54:24 +02:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2023-08-13 13:05:26 +02:00
										 |  |  |     [[nodiscard]] static JS::NonnullGCPtr<CloseEvent> create(JS::Realm&, FlyString const& event_name, CloseEventInit const& event_init = {}); | 
					
						
							| 
									
										
										
										
											2023-03-05 09:54:17 +01:00
										 |  |  |     static WebIDL::ExceptionOr<JS::NonnullGCPtr<CloseEvent>> construct_impl(JS::Realm&, FlyString const& event_name, CloseEventInit const& event_init); | 
					
						
							| 
									
										
										
										
											2021-04-24 13:54:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-08 22:29:40 +02:00
										 |  |  |     virtual ~CloseEvent() override; | 
					
						
							| 
									
										
										
										
											2021-04-24 13:54:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-10-01 18:16:12 +03:00
										 |  |  |     bool was_clean() const { return m_was_clean; } | 
					
						
							| 
									
										
										
										
											2021-04-24 13:54:24 +02:00
										 |  |  |     u16 code() const { return m_code; } | 
					
						
							| 
									
										
										
										
											2023-03-05 09:54:17 +01:00
										 |  |  |     String reason() const { return m_reason; } | 
					
						
							| 
									
										
										
										
											2021-04-24 13:54:24 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-08-08 22:29:40 +02:00
										 |  |  | private: | 
					
						
							| 
									
										
										
										
											2023-03-05 09:54:17 +01:00
										 |  |  |     CloseEvent(JS::Realm&, FlyString const& event_name, CloseEventInit const& event_init); | 
					
						
							| 
									
										
										
										
											2022-09-25 16:38:21 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-07 08:41:28 +02:00
										 |  |  |     virtual void initialize(JS::Realm&) override; | 
					
						
							| 
									
										
										
										
											2023-01-10 06:28:20 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-24 13:54:24 +02:00
										 |  |  |     bool m_was_clean { false }; | 
					
						
							|  |  |  |     u16 m_code { 0 }; | 
					
						
							| 
									
										
										
										
											2023-03-05 09:54:17 +01:00
										 |  |  |     String m_reason; | 
					
						
							| 
									
										
										
										
											2021-04-24 13:54:24 +02:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |