mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-07 09:04:30 +00:00
LibWeb: Return the ID of queued global events
This will allow callers to track the event.
This commit is contained in:
committed by
Andreas Kling
parent
3a50cadddf
commit
4806cf9527
@@ -339,7 +339,7 @@ void EventLoop::process()
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-global-task
|
||||
void queue_global_task(HTML::Task::Source source, JS::Object& global_object, JS::SafeFunction<void()> steps)
|
||||
int queue_global_task(HTML::Task::Source source, JS::Object& global_object, JS::SafeFunction<void()> steps)
|
||||
{
|
||||
// 1. Let event loop be global's relevant agent's event loop.
|
||||
auto& global_custom_data = verify_cast<Bindings::WebEngineCustomData>(*global_object.vm().custom_data());
|
||||
@@ -354,6 +354,8 @@ void queue_global_task(HTML::Task::Source source, JS::Object& global_object, JS:
|
||||
|
||||
// 3. Queue a task given source, event loop, document, and steps.
|
||||
event_loop.task_queue().add(HTML::Task::create(source, document, move(steps)));
|
||||
|
||||
return event_loop.task_queue().last_added_task()->id();
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/#queue-a-microtask
|
||||
|
||||
Reference in New Issue
Block a user