summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/FormDataEvent.h
blob: 3c2a4254e2f35af45ade2436f3898827e40c7d2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
 * Copyright (c) 2023, Kenneth Myhra <kennethmyhra@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <LibWeb/DOM/Event.h>
#include <LibWeb/XHR/FormData.h>

namespace Web::HTML {

struct FormDataEventInit : public DOM::EventInit {
    JS::GCPtr<XHR::FormData> form_data {};
};

class FormDataEvent final : public DOM::Event {
    WEB_PLATFORM_OBJECT(FormDataEvent, DOM::Event);

public:
    static WebIDL::ExceptionOr<JS::NonnullGCPtr<FormDataEvent>> construct_impl(JS::Realm&, DeprecatedString const& event_name, FormDataEventInit const& event_init);

    virtual ~FormDataEvent() override;

    JS::GCPtr<XHR::FormData> form_data() const { return m_form_data; }

private:
    FormDataEvent(JS::Realm&, DeprecatedString const& event_name, FormDataEventInit const& event_init);

    JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;

    virtual void visit_edges(Cell::Visitor&) override;

    JS::GCPtr<XHR::FormData> m_form_data;
};

}