Interface: IProcedureModel
Defined in: packages/blockly/core/interfaces/i_procedure_model.ts:13
A data model for a procedure.
Methods index
| Method | Description |
|---|---|
| setName | Sets the human-readable name of the procedure. |
| insertParameter | Inserts a parameter into the list of parameters. |
| deleteParameter | Removes the parameter at the given index from the parameter list. |
| setReturnTypes | Sets the return type(s) of the procedure. |
| setEnabled | Sets whether this procedure is enabled/disabled. If a procedure is disabled all procedure caller blocks should be disabled as well. |
| getId | Returns the unique language-neutral ID for the procedure. |
| getName | Returns the human-readable name of the procedure. |
| getParameter | Returns the parameter at the given index in the parameter list. |
| getParameters | Returns an array of all of the parameters in the parameter list. |
| getReturnTypes | Returns the return type(s) of the procedure. |
| getEnabled | Returns whether the procedure is enabled/disabled. If a procedure is disabled, all procedure caller blocks should be disabled as well. |
| saveState | Serializes the state of the procedure to JSON. |
Methods
setName()
setName(name): this;
Defined in: packages/blockly/core/interfaces/i_procedure_model.ts:15
Sets the human-readable name of the procedure.
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
this
insertParameter()
insertParameter(parameterModel, index): this;
Defined in: packages/blockly/core/interfaces/i_procedure_model.ts:22
Inserts a parameter into the list of parameters.
To move a parameter, first delete it, and then re-insert.
Parameters
| Parameter | Type |
|---|---|
parameterModel | IParameterModel |
index | number |
Returns
this
deleteParameter()
deleteParameter(index): this;
Defined in: packages/blockly/core/interfaces/i_procedure_model.ts:25
Removes the parameter at the given index from the parameter list.
Parameters
| Parameter | Type |
|---|---|
index | number |
Returns
this
setReturnTypes()
setReturnTypes(types): this;
Defined in: packages/blockly/core/interfaces/i_procedure_model.ts:32
Sets the return type(s) of the procedure.
Pass null to represent a procedure that does not return.
Parameters
| Parameter | Type |
|---|---|
types | string[] | null |
Returns
this
setEnabled()
setEnabled(enabled): this;
Defined in: packages/blockly/core/interfaces/i_procedure_model.ts:38
Sets whether this procedure is enabled/disabled. If a procedure is disabled all procedure caller blocks should be disabled as well.
Parameters
| Parameter | Type |
|---|---|
enabled | boolean |
Returns
this
getId()
getId(): string;
Defined in: packages/blockly/core/interfaces/i_procedure_model.ts:41
Returns the unique language-neutral ID for the procedure.
Returns
string
getName()
getName(): string;
Defined in: packages/blockly/core/interfaces/i_procedure_model.ts:44
Returns the human-readable name of the procedure.
Returns
string
getParameter()
getParameter(index): IParameterModel;
Defined in: packages/blockly/core/interfaces/i_procedure_model.ts:47
Returns the parameter at the given index in the parameter list.
Parameters
| Parameter | Type |
|---|---|
index | number |
Returns
getParameters()
getParameters(): IParameterModel[];
Defined in: packages/blockly/core/interfaces/i_procedure_model.ts:50
Returns an array of all of the parameters in the parameter list.
Returns
getReturnTypes()
getReturnTypes(): string[] | null;
Defined in: packages/blockly/core/interfaces/i_procedure_model.ts:57
Returns the return type(s) of the procedure.
Null represents a procedure that does not return a value.
Returns
string[] | null
getEnabled()
getEnabled(): boolean;
Defined in: packages/blockly/core/interfaces/i_procedure_model.ts:63
Returns whether the procedure is enabled/disabled. If a procedure is disabled, all procedure caller blocks should be disabled as well.
Returns
boolean
saveState()
saveState(): State;
Defined in: packages/blockly/core/interfaces/i_procedure_model.ts:70
Serializes the state of the procedure to JSON.
Returns
JSON serializable state of the procedure.