userctx: inject user context

This commit is contained in:
Pierre Tachoire
2024-04-16 12:06:29 +02:00
parent c1b73dfdc2
commit e18d04a799
10 changed files with 31 additions and 4 deletions

View File

@@ -28,6 +28,7 @@ const storage = @import("storage/storage.zig");
const html_test = @import("html_test.zig").html;
pub const Types = jsruntime.reflect(apiweb.Interfaces);
pub const UserContext = apiweb.UserContext;
var doc: *parser.DocumentHTML = undefined;
@@ -39,6 +40,10 @@ fn execJS(
try js_env.start(alloc);
defer js_env.stop();
js_env.setUserContext(UserContext{
.document = doc,
});
var storageShelf = storage.Shelf.init(alloc);
defer storageShelf.deinit();