-
Notifications
You must be signed in to change notification settings - Fork 6
zigar.function.Promise(T).resolve(self, value)
Chung Leong edited this page Oct 21, 2025
·
5 revisions
Resolve the promise by invoking callback with the value given as an argument alongside the opaque
pointer stored in the struct.
Usage:
const std = @import("std");
const zigar = @import("zigar");
const Promise = zigar.function.Promise(error{OutOfMemory}![]const u8);
pub fn getText(a: std.mem.Allocator, promise: Promise) void {
promise.resolve(a.dupe(u8, "Hello world"));
}import { getText } from './promise-example-1.zig';
const text = await getText();
console.log(text.string);Hello world
Arguments:
-
self:@This() -
value:T
Return value:
void