diff --git a/src/browser/Factory.zig b/src/browser/Factory.zig index 1f3e45ba..696ae98c 100644 --- a/src/browser/Factory.zig +++ b/src/browser/Factory.zig @@ -31,6 +31,7 @@ const Element = @import("webapi/Element.zig"); const Document = @import("webapi/Document.zig"); const EventTarget = @import("webapi/EventTarget.zig"); const XMLHttpRequestEventTarget = @import("webapi/net/XMLHttpRequestEventTarget.zig"); +const Blob = @import("webapi/Blob.zig"); const MemoryPoolAligned = std.heap.MemoryPoolAligned; @@ -224,6 +225,20 @@ pub fn xhrEventTarget(self: *Factory, child: anytype) !*@TypeOf(child) { return child_ptr; } +pub fn blob(self: *Factory, child: anytype) !*@TypeOf(child) { + const child_ptr = try self.createT(@TypeOf(child)); + child_ptr.* = child; + + const b = try self.createT(Blob); + child_ptr._proto = b; + b.* = .{ + ._type = unionInit(Blob.Type, child_ptr), + .slice = "", + .mime = "", + }; + return child_ptr; +} + pub fn create(self: *Factory, value: anytype) !*@TypeOf(value) { const ptr = try self.createT(@TypeOf(value)); ptr.* = value;