Skip to main content

blockly > CodeGenerator > injectId

CodeGenerator.injectId() method

Inject a block ID into a message to replace '%1'. Used for STATEMENT_PREFIX, STATEMENT_SUFFIX, and INFINITE_LOOP_TRAP.

Signature:

injectId(msg: string, block: Block): string;

Parameters

Parameter

Type

Description

msg

string

Code snippet with '%1'.

block

Block

Block which has an ID.

Returns:

string

Code snippet with ID.