initial Blob support on zigdom

This commit is contained in:
Halil Durak
2025-11-20 20:05:01 +03:00
parent b504a79bf7
commit 6784388a42
3 changed files with 85 additions and 0 deletions

View File

@@ -564,4 +564,6 @@ pub const JsApis = flattenTypes(&.{
@import("../webapi/IntersectionObserver.zig"),
@import("../webapi/CustomElementRegistry.zig"),
@import("../webapi/ResizeObserver.zig"),
@import("../webapi/file/Blob.zig"),
@import("../webapi/File.zig"),
});

View File

@@ -0,0 +1,44 @@
// Copyright (C) 2023-2025 Lightpanda (Selecy SAS)
//
// Francis Bouvier <francis@lightpanda.io>
// Pierre Tachoire <pierre@lightpanda.io>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
const std = @import("std");
const Blob = @import("file/Blob.zig");
const js = @import("../js/js.zig");
const File = @This();
/// `File` inherits `Blob`.
_proto: *Blob,
// TODO: Implement File API.
pub fn init() File {
return .{ ._proto = undefined };
}
pub const JsApi = struct {
pub const bridge = js.Bridge(File);
pub const Meta = struct {
pub const name = "File";
pub const prototype_chain = bridge.prototypeChain();
pub var class_id: bridge.ClassId = undefined;
};
pub const constructor = bridge.constructor(File.init, .{});
};

View File

@@ -0,0 +1,39 @@
// Copyright (C) 2023-2025 Lightpanda (Selecy SAS)
//
// Francis Bouvier <francis@lightpanda.io>
// Pierre Tachoire <pierre@lightpanda.io>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
const std = @import("std");
const js = @import("../../js/js.zig");
const Blob = @This();
pub fn init() Blob {
return .{};
}
pub const JsApi = struct {
pub const bridge = js.Bridge(Blob);
pub const Meta = struct {
pub const name = "Blob";
pub const prototype_chain = bridge.prototypeChain();
pub var class_id: bridge.ClassId = undefined;
};
pub const constructor = bridge.constructor(Blob.init, .{});
};