@@ -156,7 +156,7 @@ pub fn Env(comptime State: type, comptime WebApis: type) type {
156156 return struct {
157157 allocator : Allocator ,
158158
159- platform : * const Platform ,
159+ platform : ? * const Platform ,
160160
161161 // the global isolate
162162 isolate : v8.Isolate ,
@@ -183,7 +183,7 @@ pub fn Env(comptime State: type, comptime WebApis: type) type {
183183
184184 const Opts = struct {};
185185
186- pub fn init (allocator : Allocator , platform : * const Platform , _ : Opts ) ! * Self {
186+ pub fn init (allocator : Allocator , platform : ? * const Platform , _ : Opts ) ! * Self {
187187 // var params = v8.initCreateParams();
188188 var params = try allocator .create (v8 .CreateParams );
189189 errdefer allocator .destroy (params );
@@ -264,7 +264,13 @@ pub fn Env(comptime State: type, comptime WebApis: type) type {
264264 }
265265
266266 pub fn pumpMessageLoop (self : * const Self ) bool {
267- return self .platform .inner .pumpMessageLoop (self .isolate , false );
267+ if (self .platform == null ) return false ;
268+ return self .platform .? .inner .pumpMessageLoop (self .isolate , false );
269+ }
270+
271+ pub fn runIdleTasks (self : * const Self ) void {
272+ if (self .platform == null ) return ;
273+ return self .platform .? .inner .runIdleTasks (self .isolate , 1 );
268274 }
269275
270276 pub fn newExecutionWorld (self : * Self ) ! ExecutionWorld {
0 commit comments