Practic Force Directed - v1.0.0
    Preparing search index...

    Function forceGraphLayoutInWorker

    • Lay out a graph in a worker answering with forceGraphHandleLayoutMessages, such as the one forceGraphCreateLayoutWorker starts, so the page stays responsive. Requests to the same worker run one after another. Aborting rejects at once and ignores the worker's late answer; terminate the worker to stop its work too.

      Type Parameters

      Parameters

      • worker: Worker

        Worker that lays out the graph.

      • options: Omit<ForceGraphLayoutOptions<Node, Link>, "forces" | "onProgress" | "signal"> & {
            forces?: {
                center?: false | SimulationCenter3D;
                charge?: number;
                collide?: number;
                linkDistance?: number;
                linkStrength?: number;
            };
            linkEnds?: ForceGraphLinkEnds;
        } & { nodes: Node[] }

        What to lay out and how.

      • Optionalhandlers: { onProgress?: (percent: number) => void; signal?: AbortSignal }

        Optional progress and cancellation.

        • OptionalonProgress?: (percent: number) => void

          Receives the whole percentage each time it changes.

        • Optionalsignal?: AbortSignal

          Rejects the call with the signal's reason when aborted.

      Returns Promise<ForceGraphCoords3DRes<Node, Link>>

      The laid-out graph as JSON.

    • Lay out a graph in a worker answering with forceGraphHandleLayoutMessages, such as the one forceGraphCreateLayoutWorker starts, so the page stays responsive. Requests to the same worker run one after another. Aborting rejects at once and ignores the worker's late answer; terminate the worker to stop its work too.

      Parameters

      • worker: Worker

        Worker that lays out the graph.

      • Optionaloptions: ForceGraphLayoutWorkerOptions<
            ForceGraphNode3D,
            ForceGraphLink3D<ForceGraphNode3D>,
        >

        What to lay out and how.

      • Optionalhandlers: { onProgress?: (percent: number) => void; signal?: AbortSignal }

        Optional progress and cancellation.

        • OptionalonProgress?: (percent: number) => void

          Receives the whole percentage each time it changes.

        • Optionalsignal?: AbortSignal

          Rejects the call with the signal's reason when aborted.

      Returns Promise<ForceGraphCoords3DRes>

      The laid-out graph as JSON.