Class: ObservableProcedureModel
Defined in: plugins/block-shareable-procedures/src/observable_procedure_model.ts:19
Represents a procedure signature.
Implements
IProcedureModel
Methods index
| Method | Description |
|---|---|
| deleteParameter | Removes the parameter at the given index from the parameter list. |
| getEnabled | Returns whether the 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 of the procedure. Null represents a procedure that does not return a value. |
| insertParameter | Inserts a parameter into the list of parameters. To move a parameter, first delete it, and then re-insert. |
| saveState | Serializes the state of the procedure to JSON. |
| setEnabled | Sets whether this procedure is enabled/disabled. If a procedure is disabled all procedure caller blocks should be disabled as well. |
| setName | Sets the human-readable name of the procedure. |
| setReturnTypes | Sets whether the procedure has a return value (empty array) or no return value (null). This procedure model does not support procedures that have actual return types (i.e. non-empty arrays, e.g. ['number']). |
| loadState | Returns a new procedure model with the given state. |
Constructors
Constructor
new ObservableProcedureModel(
workspace,
name,
id?
): ObservableProcedureModel;
Defined in: plugins/block-shareable-procedures/src/observable_procedure_model.ts:37
Constructor for the procedure model.
Parameters
| Parameter | Type | Description |
|---|---|---|
workspace | Workspace | The workspace the procedure model is associated with. |
name | string | The name of the new procedure. |
id? | string | The (optional) unique language-neutral ID for the procedure. |
Returns
ObservableProcedureModel
Methods
deleteParameter()
deleteParameter(index): this;
Defined in: plugins/block-shareable-procedures/src/observable_procedure_model.ts:112
Removes the parameter at the given index from the parameter list.
Parameters
| Parameter | Type | Description |
|---|---|---|
index | number | The index of the parameter to remove. |
Returns
this
This procedure model.
Implementation of
Blockly.procedures.IProcedureModel.deleteParameter
getEnabled()
getEnabled(): boolean;
Defined in: plugins/block-shareable-procedures/src/observable_procedure_model.ts:243
Returns whether the procedure is enabled/disabled. If a procedure is disabled, all procedure caller blocks should be disabled as well.
Returns
boolean
Returns whether the procedure is enabled/disabled.
Implementation of
Blockly.procedures.IProcedureModel.getEnabled
getId()
getId(): string;
Defined in: plugins/block-shareable-procedures/src/observable_procedure_model.ts:201
Returns
string
The unique language-neutral ID for the procedure.
Implementation of
Blockly.procedures.IProcedureModel.getId
getName()
getName(): string;
Defined in: plugins/block-shareable-procedures/src/observable_procedure_model.ts:208
Returns
string
The human-readable name of the procedure
Implementation of
Blockly.procedures.IProcedureModel.getName
getParameter()
getParameter(index): IParameterModel;
Defined in: plugins/block-shareable-procedures/src/observable_procedure_model.ts:216
Parameters
| Parameter | Type | Description |
|---|---|---|
index | number | The index of the parameter to return. |
Returns
IParameterModel
the parameter at the given index in the parameter list.
Implementation of
Blockly.procedures.IProcedureModel.getParameter
getParameters()
getParameters(): IParameterModel[];
Defined in: plugins/block-shareable-procedures/src/observable_procedure_model.ts:223
Returns
IParameterModel[]
an array of all of the parameters in the parameter list.
Implementation of
Blockly.procedures.IProcedureModel.getParameters
getReturnTypes()
getReturnTypes(): string[];
Defined in: plugins/block-shareable-procedures/src/observable_procedure_model.ts:233
Returns the return type of the procedure. Null represents a procedure that does not return a value.
Returns
string[]
the return type of the procedure.
Implementation of
Blockly.procedures.IProcedureModel.getReturnTypes
insertParameter()
insertParameter(parameterModel, index): this;
Defined in: plugins/block-shareable-procedures/src/observable_procedure_model.ts:71
Inserts a parameter into the list of parameters. To move a parameter, first delete it, and then re-insert.
Parameters
| Parameter | Type | Description |
|---|---|---|
parameterModel | ObservableParameterModel | The parameter model to insert. |
index | number | The index to insert it at. |
Returns
this
This procedure model.
Implementation of
Blockly.procedures.IProcedureModel.insertParameter
saveState()
saveState(): State;
Defined in: plugins/block-shareable-procedures/src/observable_procedure_model.ts:279
Serializes the state of the procedure to JSON.
Returns
State
JSON serializable state of the procedure.
Implementation of
Blockly.procedures.IProcedureModel.saveState
setEnabled()
setEnabled(enabled): this;
Defined in: plugins/block-shareable-procedures/src/observable_procedure_model.ts:167
Sets whether this procedure is enabled/disabled. If a procedure is disabled all procedure caller blocks should be disabled as well.
Parameters
| Parameter | Type | Description |
|---|---|---|
enabled | boolean | Whether this procedure is enabled/disabled. |
Returns
this
This procedure model.
Implementation of
Blockly.procedures.IProcedureModel.setEnabled
setName()
setName(name): this;
Defined in: plugins/block-shareable-procedures/src/observable_procedure_model.ts:52
Sets the human-readable name of the procedure.
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The human-readable name of the procedure. |
Returns
this
This procedure model.
Implementation of
Blockly.procedures.IProcedureModel.setName
setReturnTypes()
setReturnTypes(types): this;
Defined in: plugins/block-shareable-procedures/src/observable_procedure_model.ts:140
Sets whether the procedure has a return value (empty array) or no return value (null). This procedure model does not support procedures that have actual return types (i.e. non-empty arrays, e.g. ['number']).
Parameters
| Parameter | Type | Description |
|---|---|---|
types | string[] | Used to set whether this procedure has a return value (empty array) or no return value (null). |
Returns
this
This procedure model.
Implementation of
Blockly.procedures.IProcedureModel.setReturnTypes
loadState()
static loadState(state, workspace): ObservableProcedureModel;
Defined in: plugins/block-shareable-procedures/src/observable_procedure_model.ts:295
Returns a new procedure model with the given state.
Parameters
| Parameter | Type | Description |
|---|---|---|
state | State | The state of the procedure to load. |
workspace | Workspace | The workspace to load the procedure into. |
Returns
ObservableProcedureModel
The loaded procedure model.