Skip to main content

Home > 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

ParameterTypeDescription
msgstringCode snippet with '%1'.
blockBlockBlock which has an ID.

Returns:

string

Code snippet with ID.