Creates a promise with custom resolvers for
resolve
andreject
.
💡
This is same as the new static method Promise.withResolvers()
.
Syntax
import { aResolvers } from '@opentf/std';
const { promise, resolve, reject } = aResolvers();
Examples
const { promise, resolve, reject } = aResolvers()
Math.random() > 0.5 ? resolve(console.log("ok")) : reject("not ok");