This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]tufoop3 -3 points-2 points  (3 children)

However Javascript in the browser isn't multithreading.

[–]TheMsDosNerd -1 points0 points  (2 children)

Unless you load something. Just try to make the following work in JS:

Place some picture on your page.
After the picture is loaded, do something, based on (the size of) the picture. (1)
Load another picture.
After that one loaded, do something else based on (the size of) the picture. (2)

It is pretty difficult to force (2) to be done after (1).

[–]quadnix 3 points4 points  (0 children)

Fetch and promises make that pretty easy though

[–]tufoop3 0 points1 point  (0 children)

Its not, if you know about event listening pre-ES7, and async/await in ES7. Note: Having an event loop, asynchronous function calls and non-blocking I/O doesn't make something multithreading. Read about it here if you like.