mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:47:44 +00:00
LibWeb: Implement window.queueMicrotask(callback)
This API allows authors to schedule a serialized JS callback that will get invoked at the next spec-allowed opportunity.
This commit is contained in:
parent
831fdcaabc
commit
a248ec63e3
10 changed files with 144 additions and 19 deletions
|
@ -21,6 +21,14 @@ public:
|
|||
void add(NonnullOwnPtr<HTML::Task>);
|
||||
OwnPtr<HTML::Task> take_first_runnable() { return m_tasks.dequeue(); }
|
||||
|
||||
void enqueue(NonnullOwnPtr<HTML::Task> task) { add(move(task)); }
|
||||
OwnPtr<HTML::Task> dequeue()
|
||||
{
|
||||
if (m_tasks.is_empty())
|
||||
return {};
|
||||
return m_tasks.dequeue();
|
||||
}
|
||||
|
||||
private:
|
||||
HTML::EventLoop& m_event_loop;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue