Web Worker Demo (Webpack) – yFiles for HTML
This demo shows how to run a yFiles layout algorithm in a Web Worker task to prevent the layout calculation from blocking the UI.
This demo uses webpack to handle the loading of the yFiles library.
The graph, layout, and layout data are configured in the main thread and transferred to the web worker using class LayoutExecutorAsync. The actual layout calculation is performed in WorkerLayout.ts with class LayoutExecutorAsyncWorker on the web worker thread.
Running the demo
First, install the required npm modules in the demo directory:
npm install
Now, start the demo:
npm start