blob: 2f1aab762e162f47b7f8479e25437e00ae579a61 (
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
|
/*
* 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 <AK/WeakPtr.h>
#include <LibCore/Forward.h>
#include <LibJS/Heap/Cell.h>
#include <LibJS/Heap/GCPtr.h>
#include <LibWeb/Forward.h>
namespace Web::HTML {
class Timer final : public JS::Cell {
JS_CELL(Timer, JS::Cell);
public:
static JS::NonnullGCPtr<Timer> create(Window&, i32 milliseconds, Function<void()> callback, i32 id);
virtual ~Timer() override;
void start();
private:
Timer(Window& window, i32 milliseconds, Function<void()> callback, i32 id);
virtual void visit_edges(Cell::Visitor&) override;
RefPtr<Platform::Timer> m_timer;
JS::NonnullGCPtr<Window> m_window;
Function<void()> m_callback;
i32 m_id { 0 };
};
}
|