Loading...
Logo
Processing Forum

hi ! 

I'm working on a sketch in processing.js, where data are dynamicaly loaded  (every seconds ) from a text file on the server through the loadString function. But, everytime I load the textfile, my sketch is slowed down by the process. Is there a way to create a threads to run this process in processing.js or javascript ? Or maybe another solution to handle this problem ? 

Replies(4)

This belongs to Processing Implementations (sigh). Moved.
And no, you cannot do that, JavaScript is a mono-threaded language...
Actually, there is. They are called Web Workers and are a fairly new invention, so understand they are not widely supported. 

You can read more on  Mozilla Developers Network and  this post by John Resig


-Kyle
Sorry to come in late, did you think of loading your data with AJAX (XMLHttpRequest)? That should give control back to your drawing
Thanks for your responses !
Three months ago, when I came with this problem, I finally discovered the existence of web workers, but I was unable to use it with processing.js. Oh, and no, I didn't think to use XMLHttpRequest, but it could be useful in the future !

Florent