mirror of
https://github.com/google/blockly.git
synced 2026-01-07 09:00:11 +01:00
Improving errors/warnings with Block.toDevString() and Connection.toString(). (#911)
This commit is contained in:
committed by
GitHub
parent
680fc4b6d3
commit
24ebbcaad0
@@ -405,9 +405,15 @@ Blockly.jsonInitFactory_ = function(jsonDef) {
|
||||
*/
|
||||
Blockly.defineBlocksWithJsonArray = function(jsonArray) {
|
||||
for (var i = 0, elem; elem = jsonArray[i]; i++) {
|
||||
Blockly.Blocks[elem.type] = {
|
||||
init: Blockly.jsonInitFactory_(elem)
|
||||
};
|
||||
var typename = elem.type;
|
||||
if (typename == null || typename === '') {
|
||||
console.warn('Block definition #' + i +
|
||||
' in JSON array is missing a type attribute. Skipping.');
|
||||
} else {
|
||||
Blockly.Blocks[typename] = {
|
||||
init: Blockly.jsonInitFactory_(elem)
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user