Class: GraphLayoutWorker
A layout worker and the requests sent to it. Most callers use the shared one through layoutInWorker; make your own for a worker that serves one chart and ends with it.
Constructors
Constructor
new GraphLayoutWorker(options?): GraphLayoutWorker;Parameters
| Parameter | Type |
|---|---|
options | GraphLayoutWorkerOptions |
Returns
GraphLayoutWorker
Accessors
pending
Get Signature
get pending(): number;Requests that have not ended: sent, waiting for the worker to load, or running here.
Returns
number
thread
Get Signature
get thread(): LayoutThread | undefined;Where requests run: 'worker' once the worker has loaded, 'main' once it is known that there is none, undefined before the first request and while the worker loads.
Returns
LayoutThread | undefined
Methods
cancel()
cancel(owner?): void;Cancel the request of owner, or every request when called without one. Their promises reject with an AbortError.
Parameters
| Parameter | Type |
|---|---|
owner? | unknown |
Returns
void
dispose()
dispose(): void;Cancel everything and end the worker. The next request starts a new one.
Returns
void
run()
run<Result>(
graph,
arrangement,
options?,
run?
): Promise<Result>;Lay graph out with a built-in arrangement and that layout's own options (ForceOptions, LayeredOptions, …: what the trace builds from its option containers and would pass to the layout in calc). Resolves with what the layout returns, the same bits as calling it directly. Rejects with an AbortError when cancelled (isLayoutAbort), and with the layout's error when it throws.
Type Parameters
| Type Parameter | Default type |
|---|---|
Result extends LayoutResult | LayoutResult |
Parameters
| Parameter | Type |
|---|---|
graph | LayoutGraph |
arrangement | | "radial" | "preset" | "force" | "layered" | "tree" | "dendrogram" | "circular" | "grid" | "arc" | "hive" |
options? | unknown |
run? | LayoutRunOptions |
Returns
Promise<Result>
start()
start(): Promise<LayoutThread>;Start the worker ahead of the first request, so that request does not wait for the file. Resolves with where requests will run.
Returns
Promise<LayoutThread>