Line | Count | Source |
1 | /* | |
2 | * Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com> | |
3 | * | |
4 | * SPDX-License-Identifier: BSD-2-Clause | |
5 | */ | |
6 | ||
7 | #pragma once | |
8 | ||
9 | #include <LibWeb/DOM/Event.h> | |
10 | ||
11 | namespace Web::HTML { | |
12 | ||
13 | struct HashChangeEventInit : public DOM::EventInit { | |
14 | String old_url; | |
15 | String new_url; | |
16 | }; | |
17 | ||
18 | class HashChangeEvent final : public DOM::Event { | |
19 | WEB_PLATFORM_OBJECT(HashChangeEvent, DOM::Event); | |
20 | JS_DECLARE_ALLOCATOR(HashChangeEvent); | |
21 | ||
22 | public: | |
23 | [[nodiscard]] static JS::NonnullGCPtr<HashChangeEvent> create(JS::Realm&, FlyString const& event_name, HashChangeEventInit const&); | |
24 | [[nodiscard]] static JS::NonnullGCPtr<HashChangeEvent> construct_impl(JS::Realm&, FlyString const& event_name, HashChangeEventInit const&); | |
25 | ||
26 | 0 | String old_url() const { return m_old_url; } |
27 | 0 | String new_url() const { return m_new_url; } |
28 | ||
29 | private: | |
30 | HashChangeEvent(JS::Realm&, FlyString const& event_name, HashChangeEventInit const& event_init); | |
31 | ||
32 | virtual void initialize(JS::Realm&) override; | |
33 | virtual void visit_edges(JS::Cell::Visitor& visitor) override; | |
34 | ||
35 | String m_old_url; | |
36 | String m_new_url; | |
37 | }; | |
38 | ||
39 | } |