initializeWebWorker()

Initializes the Web Worker for the layout calculation.

Web Workers must be provided by the application using the supply chain component, if worker layout is required. The Worker itself is very bare-bones and the Worker layout feature can be used as follows:

// in LayoutWorker.ts
import { initializeWebWorker } from '@yworks/react-yfiles-supply-chain/WebWorkerSupport'
initializeWebWorker(self)
 // in index.tsx
 const layoutWorker = new Worker(new URL('./LayoutWorker', import.meta.url), {
   type: 'module'
 })

 // ...

 return <SupplyChain data={data} layoutWorker={layoutWorker}></SupplyChain>

Parameters

NameDescriptionType
self
null
Window