Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const menuFn = function () {
const stageOptions = [
[ScratchBlocks.Msg.SENSING_OF_BACKDROPNUMBER, 'backdrop #'],
[ScratchBlocks.Msg.SENSING_OF_BACKDROPNAME, 'backdrop name'],
[ScratchBlocks.Msg.SENSING_OF_VOLUME, 'volume']
];
const spriteOptions = [
[ScratchBlocks.Msg.SENSING_OF_XPOSITION, 'x position'],
[ScratchBlocks.Msg.SENSING_OF_YPOSITION, 'y position'],
[ScratchBlocks.Msg.SENSING_OF_DIRECTION, 'direction'],
[ScratchBlocks.Msg.SENSING_OF_COSTUMENUMBER, 'costume #'],
[ScratchBlocks.Msg.SENSING_OF_COSTUMENAME, 'costume name'],
[ScratchBlocks.Msg.SENSING_OF_SIZE, 'size'],
[ScratchBlocks.Msg.SENSING_OF_VOLUME, 'volume']
];
if (vm.editingTarget) {
let lookupBlocks = vm.editingTarget.blocks;
let sensingOfBlock = lookupBlocks.getBlock(blockId);
// The block doesn't exist, but should be in the flyout. Look there.
if (!sensingOfBlock) {
sensingOfBlock = vm.runtime.flyoutBlocks.getBlock(blockId);
// If we still don't have a block, just return an empty list . This happens during
// scratch blocks construction.
if (!sensingOfBlock) {
return [['', '']];
}
// The block was in the flyout so look up future block info there.
ScratchBlocks.Blocks.event_whenbackdropswitchesto.init = function () {
const json = jsonForHatBlockMenu(
ScratchBlocks.Msg.EVENT_WHENBACKDROPSWITCHESTO,
'BACKDROP', backdropNamesMenu, eventColors, []);
this.jsonInit(json);
};
const jsonForSensingMenus = function (menuOptionsFn) {
return {
message0: ScratchBlocks.Msg.SENSING_OF,
args0: [
{
type: 'field_dropdown',
name: 'PROPERTY',
options: function () {
return menuOptionsFn();
}
},
{
type: 'input_value',
name: 'OBJECT'
}
],
output: true,
colour: ScratchBlocks.Colours.sensing.primary,
const menuFn = function () {
const stageOptions = [
[ScratchBlocks.Msg.SENSING_OF_BACKDROPNUMBER, 'backdrop #'],
[ScratchBlocks.Msg.SENSING_OF_BACKDROPNAME, 'backdrop name'],
[ScratchBlocks.Msg.SENSING_OF_VOLUME, 'volume']
];
const spriteOptions = [
[ScratchBlocks.Msg.SENSING_OF_XPOSITION, 'x position'],
[ScratchBlocks.Msg.SENSING_OF_YPOSITION, 'y position'],
[ScratchBlocks.Msg.SENSING_OF_DIRECTION, 'direction'],
[ScratchBlocks.Msg.SENSING_OF_COSTUMENUMBER, 'costume #'],
[ScratchBlocks.Msg.SENSING_OF_COSTUMENAME, 'costume name'],
[ScratchBlocks.Msg.SENSING_OF_SIZE, 'size'],
[ScratchBlocks.Msg.SENSING_OF_VOLUME, 'volume']
];
if (vm.editingTarget) {
let lookupBlocks = vm.editingTarget.blocks;
let sensingOfBlock = lookupBlocks.getBlock(blockId);