init(newPromiseIn:fromExecutor:)
Creates a promise object using the specified executor callback.
Declaration
init!(newPromiseIn context: JSContext!, fromExecutor callback: ((JSValue?, JSValue?) -> Void)!)Parameters
Return Value
A JSValue that represents a new promise JavaScript object.
Discussion
This method is equivalent to calling the Promise() constructor in JavaScript.
The resolve and reject callbacks each typically take a single value, which they forward to all relevant pending reactions. While inside the executor callback, context acts as if it is in any other callback, except calleeFunction is nil. This also means you can access the new promise object using [context thisValue].
See Also
Creating JavaScript Values
init(object:in:)init(bool:in:)init(double:in:)init(int32:in:)init(uInt32:in:)init(newObjectIn:)init(newArrayIn:)init(newRegularExpressionFromPattern:flags:in:)init(newErrorFromMessage:in:)init(undefinedIn:)init(nullIn:)init(point:inContext:)init(range:inContext:)init(rect:inContext:)init(size:inContext:)