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

Method setOutput

packages/blockly/core/block.ts:1317–1339  ·  view source on GitHub ↗

* Set whether this block returns a value. * * @param newBoolean True if there is an output. * @param opt_check Returned type or list of returned types. Null or * undefined if any type could be returned (e.g. variable get).

(newBoolean: boolean, opt_check?: string | string[] | null)

Source from the content-addressed store, hash-verified

1315 * undefined if any type could be returned (e.g. variable get).
1316 */
1317 setOutput(newBoolean: boolean, opt_check?: string | string[] | null) {
1318 if (newBoolean) {
1319 if (opt_check === undefined) {
1320 opt_check = null;
1321 }
1322 if (!this.outputConnection) {
1323 this.outputConnection = this.makeConnection_(
1324 ConnectionType.OUTPUT_VALUE,
1325 );
1326 }
1327 this.outputConnection.setCheck(opt_check);
1328 } else {
1329 if (this.outputConnection) {
1330 if (this.outputConnection.isConnected()) {
1331 throw Error(
1332 'Must disconnect output value before removing connection.',
1333 );
1334 }
1335 this.outputConnection.dispose();
1336 this.outputConnection = null;
1337 }
1338 }
1339 }
1340
1341 /**
1342 * Set whether value inputs are arranged horizontally or vertically.

Callers 7

jsonInitMethod · 0.95
text.tsFile · 0.45
lists.tsFile · 0.45
procedures.tsFile · 0.45
block_test.jsFile · 0.45
blocks.jsFile · 0.45

Calls 4

makeConnection_Method · 0.95
isConnectedMethod · 0.80
disposeMethod · 0.65
setCheckMethod · 0.45

Tested by

no test coverage detected