@@ -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 );
@@ -274,7 +274,13 @@ pub fn Env(comptime State: type, comptime WebApis: type) type {
274274 }
275275
276276 pub fn pumpMessageLoop (self : * const Self ) bool {
277- return self .platform .inner .pumpMessageLoop (self .isolate , false );
277+ if (self .platform == null ) return false ;
278+ return self .platform .? .inner .pumpMessageLoop (self .isolate , false );
279+ }
280+
281+ pub fn runIdleTasks (self : * const Self ) void {
282+ if (self .platform == null ) return ;
283+ return self .platform .? .inner .runIdleTasks (self .isolate , 1 );
278284 }
279285
280286 pub fn newExecutionWorld (self : * Self ) ! ExecutionWorld {
0 commit comments