雅虎香港 搜尋

搜尋結果

  1. 2023年10月23日 · 3) void specialization, used to communicate stateless events. The class template std::promise provides a facility to store a value or an exception that is later acquired asynchronously via a std::future object created by the std::promise object. Note that the std::promise object is meant to be used only once.

  2. 2015年5月21日 · As a final step the executeAllPromises accumulates all values of the wrapped promises and returns the final object with an array for results and an array for errors. Here is the code: // Wrap all Promises in a Promise that will always "resolve". var resolvingPromises = promises.map(function(promise) {.

  3. 2024年9月4日 · the coroutine handle, manipulated from outside the coroutine. This is a non-owning handle used to resume execution of the coroutine or to destroy the coroutine frame. the coroutine state, which is internal, dynamically-allocated storage (unless the allocation is optimized out), object that contains. the promise object.

  4. 2016年8月17日 · In Scala there is a Promise class that could be used to complete a Future manually. I am looking for an alternative in C#. I am writing a test and I want it to look it similar to this: // var My...

  5. 2020年1月17日 · Promise.all will reject as soon as one of the Promises in the array rejects. Promise.allSettled will never reject - it will resolve once all Promises in the array have either rejected or resolved. Their resolve values are different as well. Promise.all will resolve to an array of each of the values that the Promises resolve to - eg [Promise ...

  6. 2018年2月9日 · Async functions wrap their returned result in a Promise, and if you want the actual value which the promise resolved to, you have to use await someAsyncFunc(). Put in a simple example: return 1; console.log(asyncCall()); // this doesn't wait for the Promise to resolve. console.log(await asyncCall()); // this does.

  7. 2017年5月9日 · Then, Promise<{}> is compatible with Promise<number>, because basically the only property a promise has is then method, and then is compatible in these two promise types in accordance with typescript rules for function types compatibility. That's why there.

  8. 2016年9月4日 · 1 Direct Execution / Conversion. Use from to directly convert a previously created Promise to an Observable. import { from } from 'rxjs'; // getPromise () is called once, the promise is passed to the Observable const observable$ = from (getPromise ()); observable$ will be a hot Observable that effectively replays the Promises value to Subscribers.

  9. 2015年5月14日 · In modern JavaScript - no. Promises have settled (hah) and it appears like it will never be possible to cancel a (pending) promise. Instead, there is a cross-platform (Node, Browsers etc) cancellation primitive as part of WHATWG (a standards body that also builds HTML) called AbortController. You can use it to cancel functions that return ...

  10. 2017年12月2日 · You're partially right. It's because you're trying to get the result of this asynchronous call in a synchronous fashion. The only way to do this is the same way you deal with any other promise. Via a .then callback. So for your snippet:

  1. 其他人也搜尋了