### Constructor

# JavaScriptCore Value new_promise

since: 2.48

#### Declaration [src]

    JSCValue*
    jsc_value_new_promise (
      JSCContext* context,
      JSCExecutor executor,
      gpointer user_data
    )

#### Description [src]

Creates a new Promise. `executor` will be invoked during promise initialization and it receives the `resolve` and `reject` objects than can be called to resolve or reject the promise. It is called like a JavaScript function, so exceptions raised during the executor invocation will not be propagated to the context, but handled by the promise causing a rejection.

Available since: 2.48

#### Parameters

`context`

  Type: `JSCContext`

  A `JSCContext`.

  The data is owned by the caller of the function.

`executor`

  Type: `JSCExecutor`

  An initialization callback.

`user_data`

  Type: `gpointer`

  User data passed in `executor`.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

#### Return value

Type: `JSCValue`

A deferred promise object.

The caller of the function takes ownership of the data, and is responsible for freeing it.