mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
refactor _refreshExtensionPrimitives for clarity
The previous form made it harder to see that at most one extension category is handled per call.
This commit is contained in:
parent
edd6aafed0
commit
fd776025e5
1 changed files with 7 additions and 8 deletions
|
@ -825,8 +825,8 @@ class Runtime extends EventEmitter {
|
|||
* @private
|
||||
*/
|
||||
_refreshExtensionPrimitives (extensionInfo) {
|
||||
for (const categoryInfo of this._blockInfo) {
|
||||
if (extensionInfo.id === categoryInfo.id) {
|
||||
const categoryInfo = this._blockInfo.find(info => info.id === extensionInfo.id);
|
||||
if (categoryInfo) {
|
||||
categoryInfo.name = maybeFormatMessage(extensionInfo.name);
|
||||
categoryInfo.blocks = [];
|
||||
categoryInfo.menus = [];
|
||||
|
@ -835,7 +835,6 @@ class Runtime extends EventEmitter {
|
|||
this.emit(Runtime.BLOCKSINFO_UPDATE, categoryInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Read extension information, convert menus, blocks and custom field types
|
||||
|
|
Loading…
Reference in a new issue