public Promise(Action <Action <PromisedT>, Action <Exception> > resolver) { this.CurState = PromiseState.Pending; this.Id = Promise.NextId(); if (Promise.EnablePromiseTracking) { Promise.pendingPromises.Add(this); } try { resolver( // Resolve value => Resolve(value), // Reject ex => Reject(ex) ); } catch (Exception ex) { Reject(ex); } }
public Promise() { this.CurState = PromiseState.Pending; this.id = Promise.NextId(); if (Promise.EnablePromiseTracking) { Promise.PendingPromises.Add(this); } }
public Promise(bool isSync = false) { this.IsSync = isSync; this.CurState = PromiseState.Pending; this.id = Promise.NextId(); if (Promise.EnablePromiseTracking) { Promise.PendingPromises.Add(this); } }
public Promise(Action <Action <PromisedT>, Action <Exception> > resolver) { CurState = PromiseState.Pending; Id = Promise.NextId(); if (Promise.EnablePromiseTracking) { Promise.PendingPromises.Add(this); } try { resolver(Resolve, Reject); } catch (Exception ex) { Reject(ex); } }
public Promise(Action <Action <PromisedT>, Action <Exception> > resolver, bool isSync = false) { this.IsSync = isSync; this.CurState = PromiseState.Pending; this.id = Promise.NextId(); if (Promise.EnablePromiseTracking) { Promise.PendingPromises.Add(this); } try { resolver(this.Resolve, this.Reject); } catch (Exception ex) { this.Reject(ex); } }
private Promise(PromiseState initialState) { CurState = initialState; id = Promise.NextId(); }