jasondavies / d3-cloud

Create word clouds in JavaScript.
https://www.jasondavies.com/wordcloud/
Other
3.82k stars 1.07k forks source link

Run from web worker #52

Open davidebaldini opened 9 years ago

davidebaldini commented 9 years ago

The d3 dependent library has achieved to run without DOM from within a web worker. However, d3-cloud still requires to run in the main browser thread, blocking UI responsiveness for large cloud elaborations.

At least this is what it appears to me. I get a "ReferenceError: Canvas is not defined" running from a web worker.

Is it possible to solve this, or are there workarounds?

jasondavies commented 9 years ago

Interesting idea. The part that draws and retrieves text won’t work inside a Web Worker. The current algorithm requires each word to be placed serially, but perhaps an alternative parallel algorithm could be used instead.

Bnaya commented 5 years ago

OffScreen canvas support is available in chrome, and coming to other browsers https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvas

OffScreen canvas = webworker

erivan commented 5 years ago

@Bnaya Thanks for your suggestion