### Constructor

# JavaScriptCore Value new_promise

#### 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` | `JSCContext`
| A `JSCContext`.
| The data is owned by the caller of the function.
`executor` | `JSCExecutor`
| An initialization callback.
`user_data` | `gpointer`
| User data passed in `executor`.
| The argument can be `NULL`.
| The data is owned by the caller of the function.

#### Return value

Returns: | `JSCValue`
| A deferred promise object.
| The caller of the function takes ownership of the data, and is responsible for freeing it.