using System.Threading; using System; using Implab.Diagnostics; using System.Collections.Generic; using System.Linq; namespace Implab { public static class PromiseExtensions { public static IPromise Then(this IPromise that, Action fulfilled, Action rejected) { var reaction = new PromiseActionReaction(fulfilled, rejected, Promise.DefaultDispatcher); that.Then(reaction); return reaction.Promise; } public static IPromise Then(this IPromise that, Action fulfilled, Func rejected) { var reaction = new PromiseActionReaction(fulfilled, rejected, Promise.DefaultDispatcher); that.Then(reaction); return reaction.Promise; } public static IPromise Then(this IPromise that, Func fulfilled, Action rejected) { var reaction = new PromiseActionReaction(fulfilled, rejected, Promise.DefaultDispatcher); that.Then(reaction); return reaction.Promise; } public static IPromise Then(this IPromise that, Func fulfilled, Func rejected) { var reaction = new PromiseActionReaction(fulfilled, rejected, Promise.DefaultDispatcher); that.Then(reaction); return reaction.Promise; } public static IPromise Then(this IPromise that, Action fulfilled, Action rejected) { var reaction = new PromiseActionReaction(fulfilled, rejected, Promise.DefaultDispatcher); that.Then(reaction); return reaction.Promise; } public static IPromise Then(this IPromise that, Action fulfilled, Func rejected) { var reaction = new PromiseActionReaction(fulfilled, rejected, Promise.DefaultDispatcher); that.Then(reaction); return reaction.Promise; } public static IPromise Then(this IPromise that, Func fulfilled, Action rejected) { var reaction = new PromiseActionReaction(fulfilled, rejected, Promise.DefaultDispatcher); that.Then(reaction); return reaction.Promise; } public static IPromise Then(this IPromise that, Func fulfilled, Func rejected) { var reaction = new PromiseActionReaction(fulfilled, rejected, Promise.DefaultDispatcher); that.Then(reaction); return reaction.Promise; } public static IPromise Then(this IPromise that, Func fulfilled, Func rejected) { var reaction = new PromiseFuncReaction(fulfilled, rejected, Promise.DefaultDispatcher); that.Then(reaction); return reaction.Promise; } public static IPromise Then(this IPromise that, Func fulfilled, Func> rejected) { var reaction = new PromiseFuncReaction(fulfilled, rejected, Promise.DefaultDispatcher); that.Then(reaction); return reaction.Promise; } public static IPromise Then(this IPromise that, Func> fulfilled, Func rejected) { var reaction = new PromiseFuncReaction(fulfilled, rejected, Promise.DefaultDispatcher); that.Then(reaction); return reaction.Promise; } public static IPromise Then(this IPromise that, Func> fulfilled, Func> rejected) { var reaction = new PromiseFuncReaction(fulfilled, rejected, Promise.DefaultDispatcher); that.Then(reaction); return reaction.Promise; } public static IPromise Then(this IPromise that, Func fulfilled, Func rejected) { var reaction = new PromiseFuncReaction(fulfilled, rejected, Promise.DefaultDispatcher); that.Then(reaction); return reaction.Promise; } public static IPromise Then(this IPromise that, Func fulfilled, Func> rejected) { var reaction = new PromiseFuncReaction(fulfilled, rejected, Promise.DefaultDispatcher); that.Then(reaction); return reaction.Promise; } public static IPromise Then(this IPromise that, Func> fulfilled, Func rejected) { var reaction = new PromiseFuncReaction(fulfilled, rejected, Promise.DefaultDispatcher); that.Then(reaction); return reaction.Promise; } public static IPromise Then(this IPromise that, Func> fulfilled, Func> rejected) { var reaction = new PromiseFuncReaction(fulfilled, rejected, Promise.DefaultDispatcher); that.Then(reaction); return reaction.Promise; } public static IPromise Catch(this IPromise that, Action rejected) { return Then(that, null, rejected); } public static IPromise Catch(this IPromise that, Func rejected) { return Then(that, null, rejected); } public static IPromise Catch(this IPromise that, Func rejected) { return Then(that, (Func)null, rejected); } public static IPromise Catch(this IPromise that, Func> rejected) { return Then(that, (Func)null, rejected); } public static IPromise Catch(this IPromise that, Func rejected) { return Then(that, (Func)null, rejected); } public static IPromise Catch(this IPromise that, Func> rejected) { return Then(that, (Func)null, rejected); } } }