* 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)
| 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. |
no test coverage detected