研究调查问卷:请告诉我们您使用 Blockly 的体验
开始调查问卷
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
blockly >通用 >createBlockDefinitionsFromJsonArray
common.createBlockDefinitionsFromJsonArray() 函数
根据 Blockly 开发者工具生成的 JSON 块定义数组定义块。
Signature:
export declare function createBlockDefinitionsFromJsonArray(jsonArray: any[]): {
[key: string]: BlockDefinition;
};
参数
参数 |
类型 |
说明 |
jsonArray |
任何 [] |
一个 JSON 块定义的数组。 |
返回:
{ [key: string]: BlockDefinition;}
已创建的块定义的映射。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-28。
[null,null,["最后更新时间 (UTC):2025-07-28。"],[[["\u003cp\u003eDefines new block types in Blockly based on an array of JSON definitions, commonly generated by the Blockly Developer Tools.\u003c/p\u003e\n"],["\u003cp\u003eTakes an array of JSON objects representing block configurations as input.\u003c/p\u003e\n"],["\u003cp\u003eReturns a dictionary/map where block type names are keys and corresponding block definitions are values, allowing access and usage of the newly defined blocks.\u003c/p\u003e\n"]]],["The `createBlockDefinitionsFromJsonArray` function defines blocks from an array of JSON block definitions. It accepts a `jsonArray` parameter, which is an array of these definitions. The function then returns a map where each key corresponds to a block definition and its value is the associated `BlockDefinition`. This effectively translates a JSON array into a set of usable block definitions.\n"],null,["[blockly](./blockly.md) \\\u003e [common](./blockly.common_namespace.md) \\\u003e [createBlockDefinitionsFromJsonArray](./blockly.common_namespace.createblockdefinitionsfromjsonarray_1_function.md)\n\ncommon.createBlockDefinitionsFromJsonArray() function\n-----------------------------------------------------\n\nDefine blocks from an array of JSON block definitions, as might be generated by the Blockly Developer Tools.\n\n**Signature:** \n\n export declare function createBlockDefinitionsFromJsonArray(jsonArray: any[]): {\n [key: string]: BlockDefinition;\n };\n\nParameters\n----------\n\n| Parameter | Type | Description |\n|-----------|---------|-------------------------------------|\n| jsonArray | any\\[\\] | An array of JSON block definitions. |\n\n**Returns:**\n\n{ \\[key: string\\]: BlockDefinition; }\n\nA map of the block definitions created."]]