
This patch attaches a HTML::EventLoop to the main thread JS::VM used for JavaScript bindings in the web engine. The goal here is to model the various task scheduling mechanisms of the HTML specification.
20 lines
361 B
C++
20 lines
361 B
C++
/*
|
|
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibJS/Runtime/VM.h>
|
|
#include <LibWeb/Bindings/MainThreadVM.h>
|
|
|
|
namespace Web::Bindings {
|
|
|
|
JS::VM& main_thread_vm()
|
|
{
|
|
static RefPtr<JS::VM> vm;
|
|
if (!vm)
|
|
vm = JS::VM::create(make<WebEngineCustomData>());
|
|
return *vm;
|
|
}
|
|
|
|
}
|