mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 00:17:45 +00:00
LibWeb: Add the IdleDeadline interface from the RequestIdleCallback spec
This commit is contained in:
parent
64df30230d
commit
11bb6e045f
6 changed files with 83 additions and 1 deletions
34
Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.h
Normal file
34
Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.h
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <LibWeb/Bindings/Wrappable.h>
|
||||
|
||||
namespace Web::RequestIdleCallback {
|
||||
|
||||
class IdleDeadline final
|
||||
: public RefCounted<IdleDeadline>
|
||||
, public Bindings::Wrappable {
|
||||
public:
|
||||
using WrapperType = Bindings::IdleDeadlineWrapper;
|
||||
using AllowOwnPtr = TrueType;
|
||||
|
||||
static NonnullRefPtr<IdleDeadline> create(double time_remaining, bool did_timeout);
|
||||
virtual ~IdleDeadline() override;
|
||||
|
||||
double time_remaining() const { return m_time_remaining; }
|
||||
bool did_timeout() const { return m_did_timeout; }
|
||||
|
||||
private:
|
||||
IdleDeadline(double time_remaining, bool did_timeout);
|
||||
|
||||
double m_time_remaining { 0 };
|
||||
bool m_did_timeout { false };
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue