Skip to main content

Class: ObservableProcedureModel

Defined in: plugins/block-shareable-procedures/src/observable_procedure_model.ts:19

Represents a procedure signature.

Implements​

  • IProcedureModel

Methods index​

MethodDescription
deleteParameterRemoves the parameter at the given index from the parameter list.
getEnabledReturns whether the procedure is enabled/disabled. If a procedure is disabled, all procedure caller blocks should be disabled as well.
getIdReturns the unique language-neutral ID for the procedure.
getNameReturns the human-readable name of the procedure
getParameterReturns the parameter at the given index in the parameter list.
getParametersReturns an array of all of the parameters in the parameter list.
getReturnTypesReturns the return type of the procedure. Null represents a procedure that does not return a value.
insertParameterInserts a parameter into the list of parameters. To move a parameter, first delete it, and then re-insert.
saveStateSerializes the state of the procedure to JSON.
setEnabledSets whether this procedure is enabled/disabled. If a procedure is disabled all procedure caller blocks should be disabled as well.
setNameSets the human-readable name of the procedure.
setReturnTypesSets 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']).
loadStateReturns 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​

ParameterTypeDescription
workspaceWorkspaceThe workspace the procedure model is associated with.
namestringThe name of the new procedure.
id?stringThe (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​

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

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

ParameterTypeDescription
parameterModelObservableParameterModelThe parameter model to insert.
indexnumberThe 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​

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

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

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

ParameterTypeDescription
stateStateThe state of the procedure to load.
workspaceWorkspaceThe workspace to load the procedure into.

Returns​

ObservableProcedureModel

The loaded procedure model.