diff --git a/Userland/Libraries/LibWeb/Platform/Timer.cpp b/Userland/Libraries/LibWeb/Platform/Timer.cpp index d3de49a958..01f015c6d0 100644 --- a/Userland/Libraries/LibWeb/Platform/Timer.cpp +++ b/Userland/Libraries/LibWeb/Platform/Timer.cpp @@ -17,7 +17,7 @@ NonnullRefPtr Timer::create() return EventLoopPlugin::the().create_timer(); } -NonnullRefPtr Timer::create_repeating(int interval_ms, Function&& timeout_handler) +NonnullRefPtr Timer::create_repeating(int interval_ms, JS::SafeFunction&& timeout_handler) { auto timer = EventLoopPlugin::the().create_timer(); timer->set_single_shot(false); @@ -26,7 +26,7 @@ NonnullRefPtr Timer::create_repeating(int interval_ms, Function&& return timer; } -NonnullRefPtr Timer::create_single_shot(int interval_ms, Function&& timeout_handler) +NonnullRefPtr Timer::create_single_shot(int interval_ms, JS::SafeFunction&& timeout_handler) { auto timer = EventLoopPlugin::the().create_timer(); timer->set_single_shot(true); diff --git a/Userland/Libraries/LibWeb/Platform/Timer.h b/Userland/Libraries/LibWeb/Platform/Timer.h index bde3ca3f3a..ff7ad6d19f 100644 --- a/Userland/Libraries/LibWeb/Platform/Timer.h +++ b/Userland/Libraries/LibWeb/Platform/Timer.h @@ -6,16 +6,16 @@ #pragma once -#include #include +#include namespace Web::Platform { class Timer : public RefCounted { public: static NonnullRefPtr create(); - static NonnullRefPtr create_repeating(int interval_ms, Function&& timeout_handler); - static NonnullRefPtr create_single_shot(int interval_ms, Function&& timeout_handler); + static NonnullRefPtr create_repeating(int interval_ms, JS::SafeFunction&& timeout_handler); + static NonnullRefPtr create_single_shot(int interval_ms, JS::SafeFunction&& timeout_handler); virtual ~Timer(); @@ -34,7 +34,7 @@ public: virtual bool is_single_shot() const = 0; virtual void set_single_shot(bool) = 0; - Function on_timeout; + JS::SafeFunction on_timeout; }; }