summaryrefslogtreecommitdiff
path: root/Userland/Services/WebContent/TimerSerenity.h
blob: d0f92008391e4f0689d2c01817c78f2131110d6b (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
39
40
41
42
/*
 * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/NonnullRefPtr.h>
#include <LibCore/Forward.h>
#include <LibWeb/Platform/Timer.h>

namespace WebContent {

class TimerSerenity final : public Web::Platform::Timer {
public:
    static NonnullRefPtr<TimerSerenity> create();

    virtual ~TimerSerenity();

    virtual void start() override;
    virtual void start(int interval_ms) override;
    virtual void restart() override;
    virtual void restart(int interval_ms) override;
    virtual void stop() override;

    virtual void set_active(bool) override;

    virtual bool is_active() const override;
    virtual int interval() const override;
    virtual void set_interval(int interval_ms) override;

    virtual bool is_single_shot() const override;
    virtual void set_single_shot(bool) override;

private:
    TimerSerenity();

    NonnullRefPtr<Core::Timer> m_timer;
};

}