don't allocate new SubtleCrypto for each access

This commit is contained in:
Halil Durak
2026-01-15 19:08:56 +03:00
parent 0549e07a90
commit 4b4bc1a4d3

View File

@@ -24,7 +24,7 @@ const Page = @import("../Page.zig");
const SubtleCrypto = @import("SubtleCrypto.zig");
const Crypto = @This();
_pad: bool = false,
_subtle: SubtleCrypto = .{},
pub const init: Crypto = .{};
@@ -46,9 +46,8 @@ pub fn randomUUID(_: *const Crypto) ![36]u8 {
return hex;
}
pub fn getSubtle(self: *const Crypto, page: *Page) !*SubtleCrypto {
_ = self;
return page._factory.create(SubtleCrypto{});
pub fn getSubtle(self: *Crypto) *SubtleCrypto {
return &self._subtle;
}
const RandomValues = union(enum) {