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

Method removeField

packages/blockly/core/inputs/input.ts:147–162  ·  view source on GitHub ↗

* Remove a field from this input. * * @param name The name of the field. * @param opt_quiet True to prevent an error if field is not present. * @returns True if operation succeeds, false if field is not present and * opt_quiet is true. * @throws {Error} if the field is not pres

(name: string, opt_quiet?: boolean)

Source from the content-addressed store, hash-verified

145 * @throws {Error} if the field is not present and opt_quiet is false.
146 */
147 removeField(name: string, opt_quiet?: boolean): boolean {
148 for (let i = 0, field; (field = this.fieldRow[i]); i++) {
149 if (field.name === name) {
150 field.dispose();
151 this.fieldRow.splice(i, 1);
152 if (this.sourceBlock.rendered) {
153 (this.sourceBlock as BlockSvg).queueRender();
154 }
155 return true;
156 }
157 }
158 if (opt_quiet) {
159 return false;
160 }
161 throw Error('Field "' + name + '" not found.');
162 }
163
164 /**
165 * Gets whether this input is visible or not.

Callers 3

procedures.tsFile · 0.80
block_test.jsFile · 0.80
input_test.jsFile · 0.80

Calls 2

queueRenderMethod · 0.80
disposeMethod · 0.65

Tested by

no test coverage detected