@@ -46,6 +46,7 @@ pub fn VM(comptime T: type) void {
4646
4747pub fn Env (
4848 comptime T : type ,
49+ comptime Inspector_T : type ,
4950 comptime JSValue_T : type ,
5051 comptime Object_T : type ,
5152) void {
@@ -64,6 +65,9 @@ pub fn Env(
6465
6566 assertDecl (T , "bindGlobal" , fn (self : * T , ob : anytype ) anyerror ! void );
6667
68+ assertDecl (T , "setInspector" , fn (self : * T , inspector : Inspector_T ) void );
69+ assertDecl (T , "getInspector" , fn (self : T ) callconv (.Inline ) ? Inspector_T );
70+
6771 assertDecl (T , "setUserContext" , fn (
6872 self : * T ,
6973 userctx : public.UserContext ,
@@ -192,6 +196,33 @@ pub fn CallbackResult(comptime T: type) void {
192196 // TODO: how to get the result?
193197}
194198
199+ pub fn Inspector (comptime T : type , comptime Env_T : type ) void {
200+
201+ // init()
202+ assertDecl (T , "init" , fn (
203+ alloc : std.mem.Allocator ,
204+ env : Env_T ,
205+ ctx : * anyopaque ,
206+ onResp : public.InspectorOnResponseFn ,
207+ onEvent : public.InspectorOnEventFn ,
208+ ) anyerror ! T );
209+
210+ // deinit()
211+ assertDecl (T , "deinit" , fn (self : T , alloc : std.mem.Allocator ) void );
212+
213+ // contextCreated()
214+ assertDecl (T , "contextCreated" , fn (
215+ self : T ,
216+ env : Env_T ,
217+ name : []const u8 ,
218+ origin : []const u8 ,
219+ auxData : ? []const u8 ,
220+ ) void );
221+
222+ // send()
223+ assertDecl (T , "send" , fn (self : T , env : Env_T , msg : []const u8 ) void );
224+ }
225+
195226// Utils
196227// -----
197228
0 commit comments