Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add export statements for BACKWARDCOMPATIBILIYDICT and initBasicProtoBlocks #3994

Merged
merged 1 commit into from
Sep 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 32 additions & 32 deletions js/basicblocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* Dictionary mapping old block names to their corresponding new block names for backward compatibility.
* @constant {Object<string, string>}
*/
const BACKWARDCOMPATIBILIYDICT = {
export const BACKWARDCOMPATIBILIYDICT = {
fullscreen: "vspace",
fillscreen2: "fillscreen",
sandwichclampcollapsed: "clamp",
Expand Down Expand Up @@ -72,41 +72,41 @@ const BACKWARDCOMPATIBILIYDICT = {
shell: "turtleshell"
};

// Define blocks here. Note: The blocks are placed on the palettes
// from bottom to top, i.e., the block at the top of a palette will be
// the last block added to a palette.
const setupFunctions = [
setupRhythmBlockPaletteBlocks,
setupRhythmBlocks,
setupMeterBlocks,
setupPitchBlocks,
setupIntervalsBlocks,
setupToneBlocks,
setupOrnamentBlocks,
setupVolumeBlocks,
setupDrumBlocks,
setupWidgetBlocks,
setupFlowBlocks,
setupNumberBlocks,
setupActionBlocks,
setupBoxesBlocks,
setupBooleanBlocks,
setupHeapBlocks,
setupDictBlocks,
setupExtrasBlocks,
setupProgramBlocks,
setupGraphicsBlocks,
setupPenBlocks,
setupMediaBlocks,
setupSensorsBlocks,
setupEnsembleBlocks
];

/**
* @public
* @param {Object} palettes
* @param {Object} blocks
* @param {Object} activity
* @returns {void}
*/
const initBasicProtoBlocks = (activity) => {
export const initBasicProtoBlocks = (activity) => {
activity.blocks.palettes = activity.palettes;
setupRhythmBlockPaletteBlocks(activity);
setupRhythmBlocks(activity);
setupMeterBlocks(activity);
setupPitchBlocks(activity);
setupIntervalsBlocks(activity);
setupToneBlocks(activity);
setupOrnamentBlocks(activity);
setupVolumeBlocks(activity);
setupDrumBlocks(activity);
setupWidgetBlocks(activity);
setupFlowBlocks(activity);
setupNumberBlocks(activity);
setupActionBlocks(activity);
setupBoxesBlocks(activity);
setupBooleanBlocks(activity);
setupHeapBlocks(activity);
setupDictBlocks(activity);
setupExtrasBlocks(activity);
setupProgramBlocks(activity);
setupGraphicsBlocks(activity);
setupPenBlocks(activity);
setupMediaBlocks(activity);
setupSensorsBlocks(activity);
setupEnsembleBlocks(activity);
setupFunctions.forEach(setup => setup(activity));

// Push protoblocks onto their palettes.
for (const protoblock in activity.blocks.protoBlockDict) {
Expand All @@ -116,4 +116,4 @@ const initBasicProtoBlocks = (activity) => {
);
}
}
};
};
Loading