2021-01-23 17:50:22 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2021, the SerenityOS developers.
|
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2021-01-23 17:50:22 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2023-03-05 14:04:14 +01:00
|
|
|
#include <AK/FlyString.h>
|
2021-01-23 17:50:22 +00:00
|
|
|
#include <LibWeb/DOM/Event.h>
|
2024-02-06 17:03:43 +13:00
|
|
|
#include <LibWeb/WebIDL/Types.h>
|
2021-01-23 17:50:22 +00:00
|
|
|
|
|
|
|
|
namespace Web::XHR {
|
|
|
|
|
|
2021-10-01 18:55:24 +03:00
|
|
|
struct ProgressEventInit : public DOM::EventInit {
|
|
|
|
|
bool length_computable { false };
|
2024-02-06 17:03:43 +13:00
|
|
|
WebIDL::UnsignedLongLong loaded { 0 };
|
|
|
|
|
WebIDL::UnsignedLongLong total { 0 };
|
2021-10-01 18:55:24 +03:00
|
|
|
};
|
|
|
|
|
|
2022-08-08 22:29:40 +02:00
|
|
|
class ProgressEvent final : public DOM::Event {
|
2022-08-28 13:42:07 +02:00
|
|
|
WEB_PLATFORM_OBJECT(ProgressEvent, DOM::Event);
|
2023-11-19 19:47:52 +01:00
|
|
|
JS_DECLARE_ALLOCATOR(ProgressEvent);
|
2022-08-08 22:29:40 +02:00
|
|
|
|
2021-01-23 17:50:22 +00:00
|
|
|
public:
|
2023-08-13 13:05:26 +02:00
|
|
|
[[nodiscard]] static JS::NonnullGCPtr<ProgressEvent> create(JS::Realm&, FlyString const& event_name, ProgressEventInit const& event_init);
|
2023-03-05 14:04:14 +01:00
|
|
|
static WebIDL::ExceptionOr<JS::NonnullGCPtr<ProgressEvent>> construct_impl(JS::Realm&, FlyString const& event_name, ProgressEventInit const& event_init);
|
2021-01-23 17:50:22 +00:00
|
|
|
|
2022-08-08 22:29:40 +02:00
|
|
|
virtual ~ProgressEvent() override;
|
2021-01-23 17:50:22 +00:00
|
|
|
|
|
|
|
|
bool length_computable() const { return m_length_computable; }
|
2024-02-06 17:04:12 +13:00
|
|
|
WebIDL::UnsignedLongLong loaded() const { return m_loaded; }
|
|
|
|
|
WebIDL::UnsignedLongLong total() const { return m_total; }
|
2021-01-23 17:50:22 +00:00
|
|
|
|
2022-08-08 22:29:40 +02:00
|
|
|
private:
|
2023-03-05 14:04:14 +01:00
|
|
|
ProgressEvent(JS::Realm&, FlyString const& event_name, ProgressEventInit const& event_init);
|
2022-09-25 18:08:29 -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-01-23 17:50:22 +00:00
|
|
|
bool m_length_computable { false };
|
2024-02-06 17:04:12 +13:00
|
|
|
WebIDL::UnsignedLongLong m_loaded { 0 };
|
|
|
|
|
WebIDL::UnsignedLongLong m_total { 0 };
|
2021-01-23 17:50:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|