Skip to content

Function: collectLayers()

ts
function collectLayers(handle): Layer[];

Defined in: layers/layer.ts:54

Every layer reachable from a chart builder's return value.

Builders hand back handles of every shape — a bare layer, { upper, middle, lower, band? }, { lines: Layer[], arrows? } — mixed in with computed data like auc or layout. A binding that wants to tear the chart down has to find the layers among that, and enumerating each handle by hand is how one gets forgotten (a model graph leaked its connectors for exactly that reason).

Walks one level into arrays and plain objects, which covers every builder here.

Parameters

ParameterType
handleunknown

Returns

Layer[]

MIT licensed. WebGL2 required.