##// END OF EJS Templates
working on diagnostics
working on diagnostics

File last commit:

r249:d82909310094 v3
r285:b6924f444abd v3
Show More
PromiseHandler.cs
101 lines | 2.8 KiB | text/x-csharp | CSharpLexer
cin
Added awaiters to promises...
r248 using System;
using System.Diagnostics;
namespace Implab {
class PromiseHandler {
cin
Implab.Test moved to xunit...
r249 public static Action<T, Deferred> Create<T>(Action<T> handler) {
cin
Added awaiters to promises...
r248 Debug.Assert(handler != null);
cin
Implab.Test moved to xunit...
r249 return (v, next) => {
cin
Added awaiters to promises...
r248 try {
handler(v);
next.Resolve();
} catch (Exception err) {
next.Reject(err);
}
};
}
cin
Implab.Test moved to xunit...
r249 public static Action<T, Deferred> Create<T>(Func<T, IPromise> handler) {
cin
Added awaiters to promises...
r248 Debug.Assert(handler != null);
cin
Implab.Test moved to xunit...
r249 return (v, next) => {
cin
Added awaiters to promises...
r248 try {
next.Resolve(handler(v));
} catch (Exception err) {
next.Reject(err);
}
};
}
cin
Implab.Test moved to xunit...
r249 public static Action<T, Deferred<T2>> Create<T, T2>(Func<T, T2> handler) {
cin
Added awaiters to promises...
r248 Debug.Assert(handler != null);
cin
Implab.Test moved to xunit...
r249 return (v, next) => {
cin
Added awaiters to promises...
r248 try {
next.Resolve(handler(v));
} catch (Exception err) {
next.Reject(err);
}
};
}
cin
Implab.Test moved to xunit...
r249 public static Action<T, Deferred<T2>> Create<T, T2>(Func<T, IPromise<T2>> handler) {
cin
Added awaiters to promises...
r248 Debug.Assert(handler != null);
cin
Implab.Test moved to xunit...
r249 return (v, next) => {
cin
Added awaiters to promises...
r248 try {
next.Resolve(handler(v));
} catch (Exception err) {
next.Reject(err);
}
};
}
cin
Implab.Test moved to xunit...
r249 public static Action<Deferred> Create(Action handler) {
cin
Added awaiters to promises...
r248 Debug.Assert(handler != null);
cin
Implab.Test moved to xunit...
r249 return (next) => {
cin
Added awaiters to promises...
r248 try {
handler();
next.Resolve();
} catch (Exception err) {
next.Reject(err);
}
};
}
cin
Implab.Test moved to xunit...
r249 public static Action<Deferred> Create(Func<IPromise> handler) {
cin
Added awaiters to promises...
r248 Debug.Assert(handler != null);
cin
Implab.Test moved to xunit...
r249 return (next) => {
cin
Added awaiters to promises...
r248 try {
next.Resolve(handler());
} catch (Exception err) {
next.Reject(err);
}
};
}
cin
Implab.Test moved to xunit...
r249 public static Action<Deferred<T2>> Create<T2>(Func<T2> handler) {
cin
Added awaiters to promises...
r248 Debug.Assert(handler != null);
cin
Implab.Test moved to xunit...
r249 return (next) => {
cin
Added awaiters to promises...
r248 try {
next.Resolve(handler());
} catch (Exception err) {
next.Reject(err);
}
};
}
cin
Implab.Test moved to xunit...
r249 public static Action<Deferred<T2>> Create<T2>(Func<IPromise<T2>> handler) {
cin
Added awaiters to promises...
r248 Debug.Assert(handler != null);
cin
Implab.Test moved to xunit...
r249 return (next) => {
cin
Added awaiters to promises...
r248 try {
next.Resolve(handler());
} catch (Exception err) {
next.Reject(err);
}
};
}
}
}