List of handlers to handle the promise fulfilling
List of handlers to handle the promise rejection
Actual promise state
Resolved promise value
True if the current promise is pending
Executes a function with the specified parameters
arguments for the function
Attaches a handler for the promise' rejected state. The method returns a new promise that will be resolved with a value that returns from the passed handler.
Attaches a common callback for the promise fulfilled and rejected states. The method returns a new promise with the state and value from the current. A value from the passed callback will be ignored unless it equals a rejected promise or exception.
Attaches handlers for the promise fulfilled and/or rejected states. The method returns a new promise that will be resolved with a value that returns from the passed handlers.
Returns the promise' value if it is fulfilled, otherwise throws an exception
Takes an iterable of promises and returns a single SyncPromise that resolves to an array of the results of the input promises. This returned promise will resolve when all the input's promises have been resolved or if the input iterable contains no promises. It rejects immediately upon any of the input promises rejecting or non-promises throwing an error and will reject with this first rejection message/error.
Returns a promise that resolves after all the given promises have either been fulfilled or rejected, with an array of objects describing each promise's outcome.
It is typically used when you have multiple asynchronous tasks that are not dependent on one another to complete successfully, or you'd always like to know the result of each promise.
In comparison, the SyncPromise returned by SyncPromise.all()
may be more appropriate
if the tasks are dependent on each other / if you'd like to reject upon any of them reject immediately.
Takes an iterable of SyncPromise objects and, as soon as one of the promises in the iterable fulfills, returns a single promise that resolves with the value from that promise. If no promises in the iterable fulfill (if all the given promises are rejected), then the returned promise is rejected with an AggregateError, a new subclass of Error that groups together individual errors.
Returns a SyncPromise object that is rejected with a given reason
Returns a SyncPromise object that is resolved with a given value.
If the value is a promise, that promise is returned; if the value is a thenable (i.e., has a "then" method), the returned promise will "follow" that thenable, adopting its eventual state; otherwise, the returned promise will be fulfilled with the value.
This function flattens nested layers of promise-like objects (e.g., a promise that resolves to a promise that resolves to something) into a single layer.
Returns a new resolved SyncPromise object with an undefined value
Class is similar to the native promise class but works synchronously