Function script::dom::bindings::import::module::jsapi::JS::AddPromiseReactions

source ·
pub unsafe extern "C" fn AddPromiseReactions(
    cx: *mut JSContext,
    promise: Handle<*mut JSObject>,
    onFulfilled: Handle<*mut JSObject>,
    onRejected: Handle<*mut JSObject>,
) -> 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).