Function mozjs_sys::jsapi::JS::NewPromiseObject

source ยท
pub unsafe extern "C" fn NewPromiseObject(
    cx: *mut JSContext,
    executor: HandleObject,
) -> *mut JSObject
Expand description

Returns a new instance of the Promise builtin class in the current compartment, with the right slot layout.

The executor can be a nullptr. In that case, the only way to resolve or reject the returned promise is via the JS::ResolvePromise and JS::RejectPromise JSAPI functions.