Skip to main content

Home > blockly > ConnectionChecker > canConnect

ConnectionChecker.canConnect() method

Check whether the current connection can connect with the target connection.

Signature:

canConnect(a: Connection | null, b: Connection | null, isDragging: boolean, opt_distance?: number): boolean;

Parameters

ParameterTypeDescription
aConnection | nullConnection to check compatibility with.
bConnection | nullConnection to check compatibility with.
isDraggingbooleanTrue if the connection is being made by dragging a block.
opt_distancenumber(Optional) The max allowable distance between the connections for drag checks.

Returns:

boolean

Whether the connection is legal.