OpenPromise
- class Communicator.Util.OpenPromise()
This represents a
Promise
that has itsresolve
andreject
functions bundled as methods attached to the promise object.
Properties
Functions
create()
Properties
- OpenPromise.Promise
- Type
PromiseConstructor
- OpenPromise.[Symbol.toStringTag]
- Type
string
Functions
create
- Communicator.Util.create()
Creates a new
OpenPromise
that does not have its state resolved or rejected.- Return type
OpenPromise
<T>
Methods
catch
- OpenPromise.catch([onrejected])
Attaches a callback for only the rejection of the Promise.
- Arguments
onrejected (
function | null()
) – optional The callback to execute when the Promise is rejected.
- Return type
Promise <T | TResult>
- Returns
A Promise for the completion of the callback.
- OpenPromise.onrejected(reason)
- Arguments
reason (
any()
) –
- Return type
TResult | PromiseLike <TResult>
reject
- OpenPromise.reject(error)
- Arguments
error (
any()
) –
- Return type
void
resolve
- OpenPromise.resolve(this, value)
- Arguments
this (
OpenPromise
<T>) –value (
T | PromiseLike
) –
- Return type
void
- OpenPromise.resolve(this)
- Arguments
this (
OpenPromise
<void>) –
- Return type
void
then
- OpenPromise.then([onfulfilled[, onrejected]])
Attaches callbacks for the resolution and/or rejection of the Promise.
- Arguments
onfulfilled (
function | null()
) – optional The callback to execute when the Promise is resolved.onrejected (
function | null()
) – optional The callback to execute when the Promise is rejected.
- Return type
Promise <TResult1 | TResult2>
- Returns
A Promise for the completion of which ever callback is executed.
- OpenPromise.onfulfilled(value)
- Arguments
value (
T()
) –
- Return type
TResult1 | PromiseLike <TResult1>
- Communicator.Util.onrejected(reason)
- Arguments
reason (
any()
) –
- Return type
TResult2 | PromiseLike <TResult2>