Merge pull request #1500 from lightpanda-io/console_table

Add console.table
This commit is contained in:
Karl Seguin
2026-02-09 16:02:40 +08:00
committed by GitHub
2 changed files with 7 additions and 2 deletions

View File

@@ -550,14 +550,14 @@ pub fn unknownObjectPropertyCallback(comptime JsApi: type) *const fn (?*const v8
} }
} }
if (JsApi == @import("../webapi/element/Html.zig") or JsApi == @import("../webapi/Element.zig") or JsApi == @import("../webapi/element/html/Custom.zig")) { if (JsApi == @import("../webapi/element/Html.zig").JsApi or JsApi == @import("../webapi/Element.zig").JsApi or JsApi == @import("../webapi/element/html/Custom.zig").JsApi) {
// react ? // react ?
if (std.mem.eql(u8, property, "props")) return 0; if (std.mem.eql(u8, property, "props")) return 0;
if (std.mem.eql(u8, property, "hydrated")) return 0; if (std.mem.eql(u8, property, "hydrated")) return 0;
if (std.mem.eql(u8, property, "isHydrated")) return 0; if (std.mem.eql(u8, property, "isHydrated")) return 0;
} }
if (JsApi == @import("../webapi/Console.zig")) { if (JsApi == @import("../webapi/Console.zig").JsApi) {
if (std.mem.eql(u8, property, "firebug")) return 0; if (std.mem.eql(u8, property, "firebug")) return 0;
} }

View File

@@ -65,6 +65,10 @@ pub fn @"error"(_: *const Console, values: []js.Value, page: *Page) void {
logger.warn(.js, "console.error", .{ValueWriter{ .page = page, .values = values, .include_stack = true }}); logger.warn(.js, "console.error", .{ValueWriter{ .page = page, .values = values, .include_stack = true }});
} }
pub fn table(_: *const Console, data: js.Value, columns: ?js.Value) void {
logger.info(.js, "console.table", .{ .data = data, .columns = columns });
}
pub fn count(self: *Console, label_: ?[]const u8, page: *Page) !void { pub fn count(self: *Console, label_: ?[]const u8, page: *Page) !void {
const label = label_ orelse "default"; const label = label_ orelse "default";
const gop = try self._counts.getOrPut(page.arena, label); const gop = try self._counts.getOrPut(page.arena, label);
@@ -178,6 +182,7 @@ pub const JsApi = struct {
pub const assert = bridge.function(Console.assert, .{}); pub const assert = bridge.function(Console.assert, .{});
pub const @"error" = bridge.function(Console.@"error", .{}); pub const @"error" = bridge.function(Console.@"error", .{});
pub const exception = bridge.function(Console.@"error", .{}); pub const exception = bridge.function(Console.@"error", .{});
pub const table = bridge.function(Console.table, .{});
pub const count = bridge.function(Console.count, .{}); pub const count = bridge.function(Console.count, .{});
pub const countReset = bridge.function(Console.countReset, .{}); pub const countReset = bridge.function(Console.countReset, .{});
pub const time = bridge.function(Console.time, .{}); pub const time = bridge.function(Console.time, .{});