mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
Make helper private
This commit is contained in:
parent
5973e2d305
commit
df9230a0ff
1 changed files with 19 additions and 20 deletions
|
@ -267,25 +267,6 @@ class Blocks {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize block fields and input fields for reporting new monitors
|
||||
* @param {!object} block Block to be paramified.
|
||||
* @return {!object} object of param key/values.
|
||||
*/
|
||||
getBlockParams (block) {
|
||||
const params = {};
|
||||
for (const key in block.fields) {
|
||||
params[key] = block.fields[key].value;
|
||||
}
|
||||
for (const inputKey in block.inputs) {
|
||||
const inputBlock = this._blocks[block.inputs[inputKey].block];
|
||||
for (const key in inputBlock.fields) {
|
||||
params[key] = inputBlock.fields[key].value;
|
||||
}
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Block management: change block field values
|
||||
* @param {!object} args Blockly change event to be processed
|
||||
|
@ -316,7 +297,7 @@ class Blocks {
|
|||
// @todo(vm#564) this will collide if multiple sprites use same block
|
||||
id: block.id,
|
||||
opcode: block.opcode,
|
||||
params: this.getBlockParams(block),
|
||||
params: this._getBlockParams(block),
|
||||
// @todo(vm#565) for numerical values with decimals, some countries use comma
|
||||
value: ''
|
||||
});
|
||||
|
@ -525,6 +506,24 @@ class Blocks {
|
|||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/**
|
||||
* Helper to serialize block fields and input fields for reporting new monitors
|
||||
* @param {!object} block Block to be paramified.
|
||||
* @return {!object} object of param key/values.
|
||||
*/
|
||||
_getBlockParams (block) {
|
||||
const params = {};
|
||||
for (const key in block.fields) {
|
||||
params[key] = block.fields[key].value;
|
||||
}
|
||||
for (const inputKey in block.inputs) {
|
||||
const inputBlock = this._blocks[block.inputs[inputKey].block];
|
||||
for (const key in inputBlock.fields) {
|
||||
params[key] = inputBlock.fields[key].value;
|
||||
}
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to add a stack to `this._scripts`.
|
||||
|
|
Loading…
Reference in a new issue