Skip to content

Commit

Permalink
Update AllMenus.js
Browse files Browse the repository at this point in the history
  • Loading branch information
LilyMakesThings authored Jun 3, 2023
1 parent 5056436 commit c688326
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions extensions/LukeManiaStudios/AllMenus.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class allmenus {
constructor () {
Scratch.vm.runtime.on('EXTENSION_ADDED', () => {
refreshMenus()
refreshMenus();
});

}
Expand All @@ -22,12 +22,12 @@
blockType: Scratch.BlockType.BUTTON
}
]
}
};
}
menureset() {
refreshMenus();
}
};
}

Scratch.vm.addListener('BLOCKSINFO_UPDATE', refreshMenus);
refreshMenus();
Expand All @@ -39,9 +39,11 @@

// Based on code by @Xeltaliv
let blockMenu = [];
// @ts-expect-error - ScratchBlocks not typed yet
// eslint-disable-next-line no-undef
let allBlocks = Object.keys(ScratchBlocks.Blocks);
allBlocks = allBlocks.filter(item => item.includes('menu') && !blacklist.includes(item));
allBlocks.forEach(item => blockMenu.push('<block id="' + item + '" type="' + item + '"/>'))
allBlocks.forEach(item => blockMenu.push('<block id="' + item + '" type="' + item + '"/>'));
blockMenu = blockMenu.join('');
console.log(blockMenu);

Expand All @@ -52,7 +54,7 @@
${categorySeparator}
</category>
`;
}
};

const vm = Scratch.vm;
const runtime = vm.runtime;
Expand All @@ -70,7 +72,7 @@
}
});
return res;
}
};
Scratch.vm.extensionManager.refreshBlocks();
}

Expand Down

0 comments on commit c688326

Please sign in to comment.