mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-30 15:41:48 +00:00
initial fetch in zig
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user