Function mozjs_sys::jsapi::JS::AddPromiseReactions

source ·
pub unsafe extern "C" fn AddPromiseReactions(
    cx: *mut JSContext,
    promise: HandleObject,
    onFulfilled: HandleObject,
    onRejected: HandleObject,
) -> bool
Expand description

Unforgeable, optimized version of the JS builtin Promise.prototype.then.

Takes a Promise instance and nullable onFulfilled/onRejected callables to enqueue as reactions for that promise. In contrast to Promise.prototype.then, this doesn’t create and return a new Promise instance.

Throws a TypeError if promise isn’t a Promise (or possibly a different error if it’s a security wrapper or dead object proxy).