initial fetch in zig

This commit is contained in:
Muki Kiboigo
2025-08-22 06:46:09 -07:00
parent 56c6e8be06
commit df0b6d5b07
6 changed files with 284 additions and 16 deletions

View File

@@ -2178,6 +2178,17 @@ pub fn Env(comptime State: type, comptime WebApis: type) type {
return error.FailedToResolvePromise;
}
}
pub fn reject(self: PromiseResolver, value: anytype) !void {
const js_context = self.js_context;
const js_value = try js_context.zigValueToJs(value);
// resolver.reject will return null if the promise isn't pending
const ok = self.resolver.reject(js_context.v8_context, js_value) orelse return;
if (!ok) {
return error.FailedToRejectPromise;
}
}
};
pub const Promise = struct {