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,15 +825,14 @@ class Runtime extends EventEmitter {
|
|||
* @private
|
||||
*/
|
||||
_refreshExtensionPrimitives (extensionInfo) {
|
||||
for (const categoryInfo of this._blockInfo) {
|
||||
if (extensionInfo.id === categoryInfo.id) {
|
||||
categoryInfo.name = maybeFormatMessage(extensionInfo.name);
|
||||
categoryInfo.blocks = [];
|
||||
categoryInfo.menus = [];
|
||||
this._fillExtensionCategory(categoryInfo, extensionInfo);
|
||||
const categoryInfo = this._blockInfo.find(info => info.id === extensionInfo.id);
|
||||
if (categoryInfo) {
|
||||
categoryInfo.name = maybeFormatMessage(extensionInfo.name);
|
||||
categoryInfo.blocks = [];
|
||||
categoryInfo.menus = [];
|
||||
this._fillExtensionCategory(categoryInfo, extensionInfo);
|
||||
|
||||
this.emit(Runtime.BLOCKSINFO_UPDATE, categoryInfo);
|
||||
}
|
||||
this.emit(Runtime.BLOCKSINFO_UPDATE, categoryInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue