Create basic TCP server for main and adapt to jsruntime arena change

Signed-off-by: Francis Bouvier <francis.bouvier@gmail.com>
This commit is contained in:
Francis Bouvier
2023-02-08 16:03:42 +01:00
parent 497a1119f8
commit 8424f061ce
2 changed files with 80 additions and 22 deletions

View File

@@ -32,10 +32,9 @@ pub fn main() !void {
const apis = jsruntime.compile(DOM.Interfaces);
// document
var base_doc = DOM.Document.init();
defer base_doc.deinit();
try base_doc.parse(html);
doc = DOM.HTMLDocument{ .proto = base_doc };
doc = DOM.HTMLDocument.init();
defer doc.deinit();
try doc.parse(html);
// create JS vm
const vm = jsruntime.VM.init();
@@ -44,8 +43,9 @@ pub fn main() !void {
// alloc
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
const alloc = gpa.allocator();
var arena = std.heap.ArenaAllocator.init(gpa.allocator());
defer arena.deinit();
// launch shell
try jsruntime.shell(alloc, false, apis, execJS, .{ .app_name = "browsercore" });
try jsruntime.shell(&arena, apis, execJS, .{ .app_name = "browsercore" });
}