summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/Timer.h
blob: 66553028a823adda2038e8d552512b566a2cd7bb (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
/*
 * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#pragma once

#include <AK/Forward.h>
#include <AK/Function.h>
#include <LibCore/Forward.h>
#include <LibWeb/Forward.h>

namespace Web::HTML {

class Timer final : public RefCounted<Timer> {
public:
    static NonnullRefPtr<Timer> create(Window& window, i32 milliseconds, Function<void()> callback, i32 id);
    ~Timer();

    void start();

private:
    Timer(Window& window, i32 milliseconds, Function<void()> callback, i32 id);

    RefPtr<Core::Timer> m_timer;
    Window& m_window;
    i32 m_id { 0 };
};

}