@@ -86,6 +86,21 namespace Implab | |||||
86 | } |
|
86 | } | |
87 |
|
87 | |||
88 | [DebuggerStepThrough] |
|
88 | [DebuggerStepThrough] | |
|
89 | public static IPromise InvokePromise(Func<IPromise> action) { | |||
|
90 | ArgumentNotNull(action, "action"); | |||
|
91 | ||||
|
92 | var p = new Promise(); | |||
|
93 | try { | |||
|
94 | action(); | |||
|
95 | p.Resolve(); | |||
|
96 | } catch (Exception err) { | |||
|
97 | p.Reject(err); | |||
|
98 | } | |||
|
99 | ||||
|
100 | return p; | |||
|
101 | } | |||
|
102 | ||||
|
103 | [DebuggerStepThrough] | |||
89 | public static IPromise<T> InvokePromise<T>(Func<IPromise<T>> action) { |
|
104 | public static IPromise<T> InvokePromise<T>(Func<IPromise<T>> action) { | |
90 | ArgumentNotNull(action, "action"); |
|
105 | ArgumentNotNull(action, "action"); | |
91 |
|
106 |
General Comments 0
You need to be logged in to leave comments.
Login now