Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallelism - Need proposal, documentation, example & guideline for starter #1686

Closed
fletchsod-developer opened this issue Jan 15, 2015 · 7 comments
Labels
Out of Scope This idea sits outside of the TypeScript language design constraints

Comments

@fletchsod-developer
Copy link

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.

@fletchsod-developer
Copy link
Author

.NET framework (for C#) have a Task API, something like Task.Run() for example. Or JQuery's $.when() for example.

@DanielRosenwasser DanielRosenwasser added the Out of Scope This idea sits outside of the TypeScript language design constraints label Jan 15, 2015
@DanielRosenwasser
Copy link
Member

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.

@fletchsod-developer
Copy link
Author

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.

@DanielRosenwasser
Copy link
Member

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.

@fletchsod-developer
Copy link
Author

Thanks. The promises and async / await are something I will have to wait on, and for web browser products to catch up.

Thanks again.

@lucabrunox
Copy link

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]);

@fletchsod-developer
Copy link
Author

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/

@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Out of Scope This idea sits outside of the TypeScript language design constraints
Projects
None yet
Development

No branches or pull requests

4 participants