change how Blob and File initialized

This commit is contained in:
Halil Durak
2025-11-21 14:51:50 +03:00
parent b4f9f968f6
commit 0142520bb8
2 changed files with 8 additions and 4 deletions

View File

@@ -34,7 +34,7 @@ slice: []const u8,
/// MIME attached to blob. Can be an empty string. /// MIME attached to blob. Can be an empty string.
mime: []const u8, mime: []const u8,
const Type = union(enum) { pub const Type = union(enum) {
generic, generic,
file: *@import("File.zig"), file: *@import("File.zig"),
}; };
@@ -76,7 +76,11 @@ pub fn init(
break :blk ""; break :blk "";
}; };
return page._factory.create(Blob{ .slice = slice, .mime = mime }); return page._factory.create(Blob{
._type = .generic,
.slice = slice,
.mime = mime,
});
} }
const largest_vector = @max(std.simd.suggestVectorLength(u8) orelse 1, 8); const largest_vector = @max(std.simd.suggestVectorLength(u8) orelse 1, 8);

View File

@@ -28,8 +28,8 @@ const File = @This();
_proto: *Blob, _proto: *Blob,
// TODO: Implement File API. // TODO: Implement File API.
pub fn init() File { pub fn init(page: *Page) !*File {
return .{ ._proto = undefined }; return page._factory.blob(File{ ._proto = undefined });
} }
pub const JsApi = struct { pub const JsApi = struct {