blockly > 连接

连接类

用于块之间的连接的类。

Signature:

export declare class Connection implements IASTNodeLocationWithBlock 

实现IASTNodeLocationWithBlock

构造函数

构造函数 修饰符 说明
(constructor)(source, type) 构造 Connection 类的新实例

属性

媒体资源 修饰符 类型 说明
CAN_CONNECT static number 用于检查两个连接是否兼容的常量。
REASON_CHECKS_FAILED static number
REASON_DIFFERENT_WORKSPACES static number
REASON_DRAG_CHECKS_FAILED static number
REASON_PREVIOUS_AND_OUTPUT static number
REASON_SELF_CONNECTION static number
REASON_SHADOW_PARENT static number
REASON_TARGET_NULL static number
REASON_WRONG_TYPE static number
sourceBlock_ protected 屏蔽
targetConnection 连接 | null 此连接所连接的连接。如果未连接,则为 null。
type number

方法

方法 修饰符 说明
connect_(childConnection) protected 将两个连接连接在一起。这是上层街区的关联。
connect(otherConnection) 将此连接连接到另一个连接。
disconnect() 断开此连接。
disconnectInternal(setParent) protected 断开此连接所连接的两个块的连接。
getCheck() 获取连接的兼容性。
getConnectionForOrphanedConnection(startBlock, orphanConnection) static 返回将接受指定连接的连接(从 startBlock 开始)。这包括兼容的连接类型和连接检查功能。
getParentAndChildConnections() protected 根据此连接及其所连接的连接,返回父连接(上级)和子连接(下级)。
getShadowDom(returnCurrent) 返回连接的阴影块的 xml 表示法。
getShadowState(returnCurrent) 返回连接的影子块的序列化对象表示形式。
getSourceBlock() 获取此连接的来源块。
isConnected() 连接是否已连接?
isSuperior() 连接是否属于上级块(在源堆栈中更高层级)?
onCheckChanged_() protected 要在此连接的兼容类型发生更改时调用的函数。
reconnect(block, inputName) 将此连接与指定块上具有指定名称的输入重新连接。如果某个连接已连接到该输入端口,则会断开该连接。
respawnShadow_() protected 如果存在与该连接相连的影子块,则重生成影子块。
setCheck(check) 更改连接的兼容性。
setShadowDom(shadowDom) 更改连接的阴影块。
setShadowState(shadowState) 更改连接的阴影块。
targetBlock() 返回此连接所连接的块。
toString() 此方法会返回一个以开发者术语(仅限英语)描述此连接的字符串。旨在用于控制台日志和错误。