Creating custom procedure data models

The data models provided by the @blockly/block-shareable-procedures plugin are built to replicate the behavior of Blockly's legacy built-in procedure blocks. This includes some behavior that you may not want for your custom procedure blocks, including:

  • Return types are not supported supported
  • All parameters are associated with a global variable

So to solve this, you can create your own custom procedure data models.

To create your own custom procedure data models, you need to implement the IProcedureModel interface for procedure models, and the IParameterModel interface for parameter models.

You will also need to call triggerProceduresUpdate from the @blockly/block-shareable-procedures plugin inside each method that modifies the procedure model, so that doProcedureUpdate will be called on your procedure blocks (causing them to rerender).