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
|
|
|
|
|
|
|
|
|
|
#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 };
|
2022-12-04 18:02:33 +00:00
|
|
|
DeprecatedString 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-02-15 18:56:00 +01:00
|
|
|
static WebIDL::ExceptionOr<JS::NonnullGCPtr<CloseEvent>> create(JS::Realm&, DeprecatedFlyString const& event_name, CloseEventInit const& event_init = {});
|
|
|
|
|
static WebIDL::ExceptionOr<JS::NonnullGCPtr<CloseEvent>> construct_impl(JS::Realm&, DeprecatedFlyString 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; }
|
2022-12-04 18:02:33 +00:00
|
|
|
DeprecatedString reason() const { return m_reason; }
|
2021-04-24 13:54:24 +02:00
|
|
|
|
2022-08-08 22:29:40 +02:00
|
|
|
private:
|
2023-01-08 19:23:00 -05:00
|
|
|
CloseEvent(JS::Realm&, DeprecatedFlyString const& event_name, CloseEventInit const& event_init);
|
2022-09-25 16:38:21 -06:00
|
|
|
|
2023-01-28 12:33:35 -05:00
|
|
|
virtual JS::ThrowCompletionOr<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 };
|
2022-12-04 18:02:33 +00:00
|
|
|
DeprecatedString m_reason;
|
2021-04-24 13:54:24 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|