Skip to content
JuDelCo edited this page May 20, 2021 · 5 revisions

Namespace: Ju.Promises

IPromise

Promise();
Promise(Action<Action, Action<Exception>> resolver);

IPromise Then(Action onResolved);
IPromise Then(Func<IPromise> onResolved);
IPromise<T> Then<T>(Func<IPromise<T>> onResolved);
IPromise Then(Action onResolved, Action<Exception> onRejected);
IPromise Then(Func<IPromise> onResolved, Action<Exception> onRejected);
IPromise<T> Then<T>(Func<IPromise<T>> onResolved, Func<Exception, IPromise<T>> onRejected);

IPromise ThenAll(Func<IEnumerable<IPromise>> chain);
IPromise ThenSequence(Func<IEnumerable<Func<IPromise>>> chain);
IPromise ThenRace(Func<IEnumerable<IPromise>> chain);

IPromise Catch(Action<Exception> onRejected);
IPromise ContinueWith(Func<IPromise> onComplete);
IPromise Finally(Action onComplete);

void Done();
void Done(Action onResolved);
void Done(Action onResolved, Action<Exception> onRejected);
void Resolve();
void Reject(Exception e);

IPromise < T >

Promise();
Promise(Action<Action<T>, Action<Exception>> resolver);

IPromise<T> Then(Action<T> onResolved);
IPromise Then(Func<T, IPromise> onResolved);
IPromise<U> Then<U>(Func<T, IPromise<U>> onResolved);
IPromise<T> Then(Action<T> onResolved, Action<Exception> onRejected);
IPromise Then(Func<T, IPromise> onResolved, Action<Exception> onRejected);
IPromise<U> Then<U>(Func<T, IPromise<U>> onResolved, Func<Exception, IPromise<U>> onRejected);

IPromise ThenAll(Func<T, IEnumerable<IPromise>> chain);
IPromise ThenSequence(Func<T, IEnumerable<Func<IPromise>>> chain);
IPromise ThenRace(Func<T, IEnumerable<IPromise>> chain);

IPromise Catch(Action<Exception> onRejected);
IPromise ContinueWith(Func<IPromise> onComplete);
IPromise<T> Finally(Action onComplete);

void Done();
void Done(Action<T> onResolved);
void Done(Action<T> onResolved, Action<Exception> onRejected);
void Resolve(T value);
void Reject(Exception e);

Promise (Static)

This static class provides methods to create promises more easily.

IPromise Resolved();
IPromise Rejected(Exception e);
IPromise<T> Resolved<T>(T value);
IPromise<T> Rejected<T>(Exception e);

IPromise All(params IPromise[] promises);
IPromise All(IEnumerable<IPromise> promises);

IPromise Sequence(params Func<IPromise>[] functions);
IPromise Sequence(IEnumerable<Func<IPromise>> functions);

IPromise Race(params IPromise[] promises);
IPromise Race(IEnumerable<IPromise> promises);
IPromise<T> Race<T>(params IPromise<T>[] promises);
IPromise<T> Race<T>(IEnumerable<IPromise<T>> promises);

Events

This event is fired when a Promise callback throws an unhandled exception.

PromiseUnhandledExceptionEvent(Exception exception);
Clone this wiki locally