MCPcopy
hub / github.com/RaspberryPiFoundation/blockly / connect

Method connect

packages/blockly/core/connection.ts:240–264  ·  view source on GitHub ↗

* Connect this connection to another connection. * * @param otherConnection Connection to connect to. * @returns Whether the blocks are now connected or not.

(otherConnection: Connection)

Source from the content-addressed store, hash-verified

238 * @returns Whether the blocks are now connected or not.
239 */
240 connect(otherConnection: Connection): boolean {
241 if (this.targetConnection === otherConnection) {
242 // Already connected together. NOP.
243 return true;
244 }
245
246 const checker = this.getConnectionChecker();
247 if (checker.canConnect(this, otherConnection, false)) {
248 const existingGroup = eventUtils.getGroup();
249 if (!existingGroup) {
250 eventUtils.setGroup(true);
251 }
252 // Determine which block is superior (higher in the source stack).
253 if (this.isSuperior()) {
254 // Superior block.
255 this.connect_(otherConnection);
256 } else {
257 // Inferior block.
258 otherConnection.connect_(this);
259 }
260 eventUtils.setGroup(existingGroup);
261 }
262
263 return this.isConnected();
264 }
265
266 /**
267 * Disconnect this connection.

Callers 15

createShadowBlockMethod · 0.95
unplugFromRowMethod · 0.80
unplugFromStackMethod · 0.80
domToBlockHeadlessFunction · 0.80
connect_Method · 0.80
reconnectMethod · 0.80
playMethod · 0.80
beepMethod · 0.80
previewMarkerMethod · 0.80
tryToConnectParentFunction · 0.80
applyConnectionsMethod · 0.80
revertDragMethod · 0.80

Calls 5

getConnectionCheckerMethod · 0.95
isSuperiorMethod · 0.95
connect_Method · 0.95
isConnectedMethod · 0.95
canConnectMethod · 0.65

Tested by

no test coverage detected