5 ms·
Yes, very true! In fact, many of the the Windows Runtime APIs are async. They get projected identically into C# with `Task` as they do into JavaScript with WinJ
by domenicd 14y ago
Yes, very true! In fact, many of the the Windows Runtime APIs are async. They get projected identically into C# with `Task` as they do into JavaScript with WinJS promises.
On cancellation, this is actually a feature of several promise libraries. When.js has it, as do WinJS promises (so those cancellable Windows Runtime APIs project just as well into JavaScript). We are hoping to add the feature to Q, but we haven't figured out the exact semantics yet, especially with regards to some of the object-capability security requirements Q attempts to address.
Of course, C# 5 has a huge advantage in their `await` and `async` keywords. But fear not! Shallow coroutines with `yield` are coming in ECMAScript 6 (the next version of JavaScript), and you can build very similar support on top of promises:
http://taskjs.org/ http://taskjs.org/