add pump message loop calls

This commit is contained in:
Pierre Tachoire
2025-06-30 15:03:52 -07:00
parent e8866a6431
commit 22a93a9c39
4 changed files with 19 additions and 2 deletions

View File

@@ -156,6 +156,8 @@ pub fn Env(comptime State: type, comptime WebApis: type) type {
return struct {
allocator: Allocator,
platform: *const Platform,
// the global isolate
isolate: v8.Isolate,
@@ -181,7 +183,7 @@ pub fn Env(comptime State: type, comptime WebApis: type) type {
const Opts = struct {};
pub fn init(allocator: Allocator, _: Opts) !*Self {
pub fn init(allocator: Allocator, platform: *const Platform, _: Opts) !*Self {
// var params = v8.initCreateParams();
var params = try allocator.create(v8.CreateParams);
errdefer allocator.destroy(params);
@@ -215,6 +217,7 @@ pub fn Env(comptime State: type, comptime WebApis: type) type {
errdefer allocator.destroy(env);
env.* = .{
.platform = platform,
.isolate = isolate,
.templates = undefined,
.allocator = allocator,
@@ -270,6 +273,10 @@ pub fn Env(comptime State: type, comptime WebApis: type) type {
self.isolate.performMicrotasksCheckpoint();
}
pub fn pumpMessageLoop(self: *const Self) bool {
return self.platform.inner.pumpMessageLoop(self.isolate, false);
}
pub fn newExecutionWorld(self: *Self) !ExecutionWorld {
return .{
.env = self,