private static void HandleNext_AllSequentially(Queue <Func <Promise> > queue, Deferred <object[]> masterDeferred, object[] args, int indexer) { if (queue.Count == 0) { masterDeferred.Resolve(args); return; } var promiseFunc = queue.Dequeue(); promiseFunc() .Then(x => { args[indexer] = x; HandleNext_AllSequentially(queue, masterDeferred, args, indexer++); }) .Fail(x => masterDeferred.Reject(x)); }
public Promise(Deferred deferred) { Deferred = deferred; }
private static IEnumerator WwwAsPromise_CoroutineHandler(WWW www, Deferred <WWW> deferred) { yield return(www); deferred.Resolve(www); }