Skip to main content

Class: ObservableParameterModel

Defined in: plugins/block-shareable-procedures/src/observable_parameter_model.ts:12

Represents a procedure parameter.

Implements​

  • IParameterModel

Methods index​

MethodDescription
createBackingVariableCreates a backing variable in a way that is subclassable.
getIdReturns the unique language-neutral ID for the parameter. This represents the identity of the variable model which does not change over time.
getNameReturns the name of this parameter.
getTypesReturns the types of this parameter.
getVariableModelReturns the variable model associated with the parameter model.
saveStateSerializes the state of this parameter to JSON.
setNameSets the name of this parameter to the given name.
setProcedureModelSets the procedure model this parameter is a part of.
setTypesUnimplemented. 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.
loadStateReturns 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​

ParameterTypeDescription
workspaceWorkspaceThe workspace this parameter model exists in.
namestringThe name of this parameter.
id?stringThe optional unique language-neutral ID of the parameter.
varId?stringThe 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​

ParameterTypeDescription
namestringThe string to set set the variable to.
varId?stringThe 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​

ParameterTypeDescription
namestringThe string to set the name to.
id?stringThe 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​

ParameterTypeDescription
modelIProcedureModelThe 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​

ParameterTypeDescription
typesstring[]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​

ParameterTypeDescription
stateParameterStateThe state of the parameter to load.
workspaceWorkspaceThe workspace to load the parameter into.

Returns​

ObservableParameterModel

The loaded parameter model.