Skip to main content

Interface: IProcedureModel

Defined in: packages/blockly/core/interfaces/i_procedure_model.ts:13

A data model for a procedure.

Methods index

MethodDescription
setNameSets the human-readable name of the procedure.
insertParameterInserts a parameter into the list of parameters.
deleteParameterRemoves the parameter at the given index from the parameter list.
setReturnTypesSets the return type(s) of the procedure.
setEnabledSets whether this 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(s) of the procedure.
getEnabledReturns whether the procedure is enabled/disabled. If a procedure is disabled, all procedure caller blocks should be disabled as well.
saveStateSerializes 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

ParameterType
namestring

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

ParameterType
parameterModelIParameterModel
indexnumber

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

ParameterType
indexnumber

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

ParameterType
typesstring[] | 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

ParameterType
enabledboolean

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

ParameterType
indexnumber

Returns

IParameterModel


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

IParameterModel[]


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

State

JSON serializable state of the procedure.