Snapshot of main at 9f39a6e1e (2026-11-02)
This commit is contained in:
commit
6ccf1792d7
2580 files changed
+1040202
No files matched your search
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Web Worker running the network layout off the page's main thread.
|
||||
*
|
||||
* In production Vite bundles it into one self-contained classic worker, which
|
||||
* older iOS versions also run; under the dev server it runs as a module worker
|
||||
* instead, since the dev server serves it unbundled (see getLayoutWorker() in
|
||||
* stats-network.js). The work itself lives in network-layout-core.js.
|
||||
*/
|
||||
import cytoscape from 'cytoscape';
|
||||
import fcose from 'cytoscape-fcose';
|
||||
import { layoutPositions } from './network-layout-core';
|
||||
|
||||
cytoscape.use(fcose);
|
||||
|
||||
self.onmessage = (event) => {
|
||||
const { id, nodes, edges, options } = event.data || {};
|
||||
|
||||
layoutPositions(cytoscape, { nodes, edges, options })
|
||||
.then((positions) => self.postMessage({ id, positions }))
|
||||
.catch((error) => self.postMessage({ id, error: String((error && error.message) || error) }));
|
||||
};
|
||||
Reference in new issue
Block a user