mirror of
https://github.com/eaglerforge/EaglerForgeBuilderNew.git
synced 2025-09-06 22:25:56 +00:00
Add new things.
This commit is contained in:
15
block_libmap.js
Normal file
15
block_libmap.js
Normal file
@@ -0,0 +1,15 @@
|
||||
const BLOCK_LIBMAP = {};
|
||||
var oldDefineBlocks = Blockly.common.defineBlocks;
|
||||
Blockly.common.defineBlocks = function (blockMap) {
|
||||
var types = Object.keys(blockMap);
|
||||
types.forEach(type => {
|
||||
BLOCK_LIBMAP[type] = (blockMap[type].libs || []);
|
||||
});
|
||||
return oldDefineBlocks.apply(this, [blockMap]);
|
||||
}
|
||||
function getBlockLibs(block) {
|
||||
return BLOCK_LIBMAP[block.type] || [];
|
||||
}
|
||||
function getBlockLibsByType(blockType) {
|
||||
return BLOCK_LIBMAP[blockType] || [];
|
||||
}
|
Reference in New Issue
Block a user