Skip to content

Commit

Permalink
Update AllMenus.js
Browse files Browse the repository at this point in the history
- Rearranged some things
- Fixed typo
  • Loading branch information
LilyMakesThings authored Jun 15, 2023
1 parent 77a7bac commit f9987b3
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions extensions/LukeManiaStudios/AllMenus.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
(function (Scratch) {
'use strict';

const vm = Scratch.vm;
const runtime = vm.runtime;

const blacklist = [
'looks_costumenumbername',
'extension_wedo_tilt_menu'
];

class allmenus {
constructor () {
Scratch.vm.runtime.on('EXTENSION_ADDED', () => {
runtime.on('EXTENSION_ADDED', () => {
refreshMenus();
});

Expand All @@ -30,15 +33,15 @@
}
}

Scratch.vm.addListener('BLOCKSINFO_UPDATE', refreshMenus);
vm.addListener('BLOCKSINFO_UPDATE', refreshMenus);
refreshMenus();

function refreshMenus() {
if (!window.ScratchBlocks) return;

Scratch.vm.removeListener('BLOCKSINFO_UPDATE', refreshMenus);
vm.removeListener('BLOCKSINFO_UPDATE', refreshMenus);

// Based on code by @Xeltaliv
// Based on code by @Xeltalliv
let blockMenu = [];
// @ts-expect-error - ScratchBlocks not typed yet
// eslint-disable-next-line no-undef
Expand All @@ -57,8 +60,6 @@
`;
};

const vm = Scratch.vm;
const runtime = vm.runtime;
const categorySeparator = '<sep gap="36"/>';
const gbx = runtime.getBlocksXML.bind(runtime);
runtime.getBlocksXML = function(target) {
Expand All @@ -74,7 +75,7 @@
});
return res;
};
Scratch.vm.extensionManager.refreshBlocks();
vm.extensionManager.refreshBlocks();
}

Scratch.extensions.register(new allmenus());
Expand Down

0 comments on commit f9987b3

Please sign in to comment.