mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-30 15:41:48 +00:00
Adopt global Types changes in jsruntime
Signed-off-by: Francis Bouvier <francis@lightpanda.io>
This commit is contained in:
@@ -7,16 +7,17 @@ const DOM = @import("dom.zig");
|
||||
|
||||
const html_test = @import("html_test.zig").html;
|
||||
|
||||
pub const Types = jsruntime.reflect(DOM.Interfaces);
|
||||
|
||||
var doc: *parser.DocumentHTML = undefined;
|
||||
|
||||
fn execJS(
|
||||
alloc: std.mem.Allocator,
|
||||
js_env: *jsruntime.Env,
|
||||
comptime apis: []jsruntime.API,
|
||||
) !void {
|
||||
) anyerror!void {
|
||||
|
||||
// start JS env
|
||||
try js_env.start(alloc, apis);
|
||||
try js_env.start(alloc);
|
||||
defer js_env.stop();
|
||||
|
||||
// alias global as self and window
|
||||
@@ -24,17 +25,14 @@ fn execJS(
|
||||
try js_env.attachObject(try js_env.getGlobal(), "window", null);
|
||||
|
||||
// add document object
|
||||
try js_env.addObject(apis, doc, "document");
|
||||
try js_env.addObject(doc, "document");
|
||||
|
||||
// launch shellExec
|
||||
try jsruntime.shellExec(alloc, js_env, apis);
|
||||
try jsruntime.shellExec(alloc, js_env);
|
||||
}
|
||||
|
||||
pub fn main() !void {
|
||||
|
||||
// generate APIs
|
||||
const apis = comptime jsruntime.compile(DOM.Interfaces);
|
||||
|
||||
// allocator
|
||||
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
|
||||
defer _ = gpa.deinit();
|
||||
@@ -55,5 +53,5 @@ pub fn main() !void {
|
||||
defer vm.deinit();
|
||||
|
||||
// launch shell
|
||||
try jsruntime.shell(&arena, apis, execJS, .{ .app_name = "browsercore" });
|
||||
try jsruntime.shell(&arena, execJS, .{ .app_name = "browsercore" });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user