Merge pull request #1366 from lightpanda-io/details_are_values
Some checks failed
e2e-test / zig build release (push) Has been cancelled
e2e-test / demo-scripts (push) Has been cancelled
e2e-test / cdp-and-hyperfine-bench (push) Has been cancelled
e2e-test / perf-fmt (push) Has been cancelled
e2e-test / browser fetch (push) Has been cancelled
zig-test / zig test (push) Has been cancelled
zig-test / perf-fmt (push) Has been cancelled

use js.Value when input can be a value
This commit is contained in:
Karl Seguin
2026-01-14 23:25:17 +00:00
committed by GitHub
3 changed files with 7 additions and 8 deletions

View File

@@ -235,7 +235,6 @@ fn _toString(self: Value, comptime null_terminate: bool, opts: js.String.ToZigOp
return js.String.toZig(str, opts);
}
pub fn fromJson(ctx: *js.Context, json: []const u8) !Value {
const v8_isolate = v8.Isolate{ .handle = ctx.isolate.handle };
const json_string = v8.String.initUtf8(v8_isolate, json);

View File

@@ -314,10 +314,10 @@ pub const Entry = struct {
pub const Mark = struct {
_proto: *Entry,
_detail: ?js.Object,
_detail: ?js.Value,
const Options = struct {
detail: ?js.Object = null,
detail: ?js.Value = null,
startTime: ?f64 = null,
};
@@ -344,7 +344,7 @@ pub const Mark = struct {
return m;
}
pub fn getDetail(self: *const Mark) ?js.Object {
pub fn getDetail(self: *const Mark) ?js.Value {
return self._detail;
}

View File

@@ -27,11 +27,11 @@ const Allocator = std.mem.Allocator;
const CustomEvent = @This();
_proto: *Event,
_detail: ?js.Object = null,
_detail: ?js.Value = null,
_arena: Allocator,
const CustomEventOptions = struct {
detail: ?js.Object = null,
detail: ?js.Value = null,
};
const Options = Event.inheritOptions(CustomEvent, CustomEventOptions);
@@ -58,7 +58,7 @@ pub fn initCustomEvent(
event_string: []const u8,
bubbles: ?bool,
cancelable: ?bool,
detail_: ?js.Object,
detail_: ?js.Value,
page: *Page,
) !void {
// This function can only be called after the constructor has called.
@@ -76,7 +76,7 @@ pub fn asEvent(self: *CustomEvent) *Event {
return self._proto;
}
pub fn getDetail(self: *const CustomEvent) ?js.Object {
pub fn getDetail(self: *const CustomEvent) ?js.Value {
return self._detail;
}