Skip to main content

Home > blockly > ConnectionChecker > canConnectWithReason

ConnectionChecker.canConnectWithReason() method

Checks whether the current connection can connect with the target connection, and return an error code if there are problems.

Signature:

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

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:

number

Connection.CAN_CONNECT if the connection is legal, an error code otherwise.