blockly > CodeGenerator > injectId
CodeGenerator.injectId() yöntemi
"%1" yerine bir iletiye engelleme kimliği ekleyin. STATEMENT_PREFIX, STATEMENT_SUFFIX ve INFINITE_LOOP_TRAP için kullanılır.
İmza:
injectId(msg: string, block: Block): string;
Parametreler
Parametre |
Tür |
Açıklama |
msg |
dize |
"%1" içeren kod snippet'i. |
engelle |
Engelle |
Kimliği olan blok. |
Şunu döndürür:
dize
Kimlik içeren kod snippet'i.
Aksi belirtilmediği sürece bu sayfanın içeriği Creative Commons Atıf 4.0 Lisansı altında ve kod örnekleri Apache 2.0 Lisansı altında lisanslanmıştır. Ayrıntılı bilgi için Google Developers Site Politikaları'na göz atın. Java, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2024-08-21 UTC.
[null,null,["Son güncelleme tarihi: 2024-08-21 UTC."],[[["The `injectId` method replaces '%1' in a code snippet with a block's ID."],["It's primarily used for statement prefixes, suffixes, and infinite loop traps."],["The method takes the code snippet and the block as input."],["It returns the modified code snippet with the block ID injected."]]],["The `injectId` method, part of the `CodeGenerator` class, replaces the '%1' placeholder within a code snippet (`msg`) with the ID of a specified `Block`. This functionality is utilized for `STATEMENT_PREFIX`, `STATEMENT_SUFFIX`, and `INFINITE_LOOP_TRAP`. It takes a string (`msg`) and a `Block` as input, then returns the modified code snippet with the block's ID inserted.\n"]]