Answer the question
In order to leave comments, you need to log in
Multitasking or threading: is it possible in a browser?
Hello everyone, I don’t know how to ask for sure) in general, there is a browser, a certain process is performed in it, very, very difficult, for example, cutting a large image into small pieces, at this moment, of course, the browser just hangs in the clouds and does not respond.
Earlier, I read something about streams, supposedly you can put an operation in a separate stream and the browser will flicker, in words it certainly sounds beautiful, but in practice you cook))
So I want to make sure that this is really done? did someone make streams?) I want to hang image slicing on a separate stream and so that the browser continues to work normally, but it seems that this is still not really possible to do.
Answer the question
In order to leave comments, you need to log in
Web Workers provide a simple means to run scripts on a background thread. A Worker thread can perform tasks without interfering with the user interface. In addition, they can do I/O using XMLHttpRequest (although the responseXML and channel attributes will always be null). An existing Worker can send messages to the JavaScript code that created it by sending messages to the event handler specified by that code (and vice versa).
break the task into small pieces, such as cutting one piece at a time, and run them one by one with setTimeout(0). the browser will have time to respond and redraw during this time.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question