comparison Implab/Deferred.cs @ 245:b904e0a3ba72 v3

working on promises
author cin
date Fri, 26 Jan 2018 04:13:34 +0300
parents eee3e49dd1ff
children 5cb4826c2c2a
comparison
equal deleted inserted replaced
244:eee3e49dd1ff 245:b904e0a3ba72
34 if (thenable == m_promise) 34 if (thenable == m_promise)
35 Reject(new Exception("The promise cannot be resolved with oneself")); 35 Reject(new Exception("The promise cannot be resolved with oneself"));
36 36
37 else if (m_dispatcher != null) 37 else if (m_dispatcher != null)
38 // dispatch (see ecma-262/6.0: 25.4.1.3.2 Promise Resolve Functions) 38 // dispatch (see ecma-262/6.0: 25.4.1.3.2 Promise Resolve Functions)
39 m_dispatcher.Enqueue(() => thenable.Then(this)); 39 m_dispatcher.Enqueue(() => Chain(thenable));
40 else 40 else
41 thenable.Then(this); 41 Chain(thenable);
42 } 42 }
43 43
44 void Chain(IPromise thenable) { 44 void Chain(IPromise thenable) {
45 try { 45 try {
46 thenable.Then(this); 46 thenable.Then(this);