Class: ObservableParameterModel
Defined in: plugins/block-shareable-procedures/src/observable_parameter_model.ts:12
Represents a procedure parameter.
Implements
IParameterModel
Methods index
| Method | Description |
|---|---|
| createBackingVariable | Creates a backing variable in a way that is subclassable. |
| getId | Returns the unique language-neutral ID for the parameter. This represents the identity of the variable model which does not change over time. |
| getName | Returns the name of this parameter. |
| getTypes | Returns the types of this parameter. |
| getVariableModel | Returns the variable model associated with the parameter model. |
| saveState | Serializes the state of this parameter to JSON. |
| setName | Sets the name of this parameter to the given name. |
| setProcedureModel | Sets the procedure model this parameter is a part of. |
| setTypes | Unimplemented. The built-in ParameterModel does not support typing. If you want your procedure blocks to have typed parameters, you need to implement your own ParameterModel. |
| loadState | Returns a new parameter model with the given state. |
Constructors
Constructor
new ObservableParameterModel(
workspace,
name,
id?,
varId?
): ObservableParameterModel;
Defined in: plugins/block-shareable-procedures/src/observable_parameter_model.ts:29
Constructor for the procedure parameter.
Parameters
| Parameter | Type | Description |
|---|---|---|
workspace | Workspace | The workspace this parameter model exists in. |
name | string | The name of this parameter. |
id? | string | The optional unique language-neutral ID of the parameter. |
varId? | string | The optional ID of the variable this parameter should be associated with. |
Returns
ObservableParameterModel
Methods
createBackingVariable()
protected createBackingVariable(name, varId?): IVariableModel<IVariableState>;
Defined in: plugins/block-shareable-procedures/src/observable_parameter_model.ts:73
Creates a backing variable in a way that is subclassable.
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The string to set set the variable to. |
varId? | string | The optional ID the backing variable should have. |
Returns
IVariableModel<IVariableState>
The created variable model.
getId()
getId(): string;
Defined in: plugins/block-shareable-procedures/src/observable_parameter_model.ts:122
Returns the unique language-neutral ID for the parameter. This represents the identity of the variable model which does not change over time.
Returns
string
The unique language-neutral ID for the parameter.
Implementation of
Blockly.procedures.IParameterModel.getId
getName()
getName(): string;
Defined in: plugins/block-shareable-procedures/src/observable_parameter_model.ts:105
Returns
string
the name of this parameter.
Implementation of
Blockly.procedures.IParameterModel.getName
getTypes()
getTypes(): string[];
Defined in: plugins/block-shareable-procedures/src/observable_parameter_model.ts:112
Returns
string[]
the types of this parameter.
Implementation of
Blockly.procedures.IParameterModel.getTypes
getVariableModel()
getVariableModel(): IVariableModel<IVariableState>;
Defined in: plugins/block-shareable-procedures/src/observable_parameter_model.ts:129
Returns
IVariableModel<IVariableState>
the variable model associated with the parameter model.
saveState()
saveState(): ParameterState;
Defined in: plugins/block-shareable-procedures/src/observable_parameter_model.ts:167
Serializes the state of this parameter to JSON.
Returns
ParameterState
JSON serializable state of the parameter.
Implementation of
Blockly.procedures.IParameterModel.saveState
setName()
setName(name, id?): this;
Defined in: plugins/block-shareable-procedures/src/observable_parameter_model.ts:46
Sets the name of this parameter to the given name.
Parameters
| Parameter | Type | Description |
|---|---|---|
name | string | The string to set the name to. |
id? | string | The optional ID the backing variable should have. |
Returns
this
This parameter model.
Implementation of
Blockly.procedures.IParameterModel.setName
setProcedureModel()
setProcedureModel(model): this;
Defined in: plugins/block-shareable-procedures/src/observable_parameter_model.ts:157
Sets the procedure model this parameter is a part of.
Parameters
| Parameter | Type | Description |
|---|---|---|
model | IProcedureModel | The procedure model this parameter is a part of. |
Returns
this
This parameter model.
Implementation of
Blockly.procedures.IParameterModel.setProcedureModel
setTypes()
setTypes(types): this;
Defined in: plugins/block-shareable-procedures/src/observable_parameter_model.ts:95
Unimplemented. The built-in ParameterModel does not support typing. If you want your procedure blocks to have typed parameters, you need to implement your own ParameterModel.
Parameters
| Parameter | Type | Description |
|---|---|---|
types | string[] | The types to set this parameter to. |
Returns
this
Throws
Throws for the ObservableParameterModel specifically because this method is unimplemented.
Implementation of
Blockly.procedures.IParameterModel.setTypes
loadState()
static loadState(state, workspace): ObservableParameterModel;
Defined in: plugins/block-shareable-procedures/src/observable_parameter_model.ts:184
Returns a new parameter model with the given state.
Parameters
| Parameter | Type | Description |
|---|---|---|
state | ParameterState | The state of the parameter to load. |
workspace | Workspace | The workspace to load the parameter into. |
Returns
ObservableParameterModel
The loaded parameter model.