diff --git a/src/browser/events/custom_event.zig b/src/browser/events/custom_event.zig index f84a9805..530eaf5c 100644 --- a/src/browser/events/custom_event.zig +++ b/src/browser/events/custom_event.zig @@ -64,7 +64,7 @@ pub const CustomEvent = struct { event_type: []const u8, can_bubble: bool, cancelable: bool, - detail: ?JsObject, + maybe_detail: ?JsObject, ) !void { // This function can only be called after the constructor has called. // So we assume proto is initialized already by constructor. @@ -73,7 +73,9 @@ pub const CustomEvent = struct { self.proto.cancelable = cancelable; self.proto.is_initialised = true; // Detail is stored separately. - self.detail = detail; + if (maybe_detail) |detail| { + self.detail = try detail.persist(); + } } };