JSObject.makeDeferredPromise constructor

JSObject.makeDeferredPromise(
  1. JSContext context,
  2. JSObjectPointer resolve,
  3. JSObjectPointer reject, {
  4. JSValuePointer? exception,
})

Creates a JavaScript promise object by invoking the provided executor. resolve (JSObjectRef*) A pointer to a JSObjectRef in which to store the resolve function for the new promise. Pass NULL if you do not care to store the resolve callback. reject (JSObjectRef*) A pointer to a JSObjectRef in which to store the reject function for the new promise. Pass NULL if you do not care to store the reject callback. exception (JSValueRef*) A pointer to a JSValueRef in which to store an exception, if any. Pass NULL if you do not care to store an exception.

Implementation

JSObject.makeDeferredPromise(
  this.context,
  JSObjectPointer resolve,
  JSObjectPointer reject, {
  JSValuePointer? exception,
}) : this.pointer = JSObjectRef.jSObjectMakeDeferredPromise(
          context.pointer,
          resolve.pointer,
          reject.pointer,
          (exception ?? JSValuePointer(nullptr)).pointer);