Closed fletchsod-developer closed 9 years ago
.NET framework (for C#) have a Task API, something like Task.Run() for example. Or JQuery's $.when() for example.
There's no way to provide runtime support for actual parallelism.
Web workers are your browser side facility, which have typings in our `lib.es6.d.ts which will be available in TypeScript 1.4. On the Node.js side, there are packages with relevant typings on DefinitelyTyped.
What are the typings in TypeScript or DefinitelyTyped in Node.js? What are the example of what they looks like? The Web workers link didn't mentioned them.
Thanks.
First off, I realized you might mean concurrency, not parallelism. If so, use ES6 promises (currently typed here). Other than that there is a proposal for async
/await
.
For Web Workers, here are the typings as of this writing.
For Node.js, find a package that appeals to you on npm. Then see if there exist typings in DefinitelyTyped. For instance, if you find parallel.js to be appealing, use the parallel.js typings on DefinitelyTyped.
Thanks. The promises and async / await are something I will have to wait on, and for web browser products to catch up.
Thanks again.
Promises already have a way to run parallel tasks and wait for all of them, of course for something non-cpu bound:
await Promise.all([promise1, promise2]);
That's true. I have learned alot 1 year later from my last posting. So, this is no longer out of scope now as javascript continue to evolve.
One other nice addition here down below, something I saw over the summer.
Here's beautiful example of what to do with ES5, ES6 and ES7 when it comes to async, promise, etc. and the usual old versions.
http://www.sitepoint.com/javascript-goes-asynchronous-awesome/
The title above pretty much sum it up.
No hurry on this and hopefully it will lead to healthy discussions.
There is conflicting knowledges on wanting to use parallism for javascript. There isn't good info out there and ES6 / ES7 is starting to come together but not much on how to use them.
The lack of parallism kept coming back to haunt us as we're forcing ourselves to use plug-ins, JQuery promises and callback hells.
The idea is to start discussing parallism leading to new TypeScript issue ticket with proposal then attach this ticket to new TypeScript issue ticket, and close this ticket.