File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -75,16 +75,19 @@ function setupEnsembleBlocks(activity) {
7575 blockInstance . setHelpString ( helpText ) ;
7676 }
7777
78+ // New function to initialize block with common properties
79+ function initializeBlock ( blockInstance , paletteName , helpText ) {
80+ blockInstance . setPalette ( paletteName , activity ) ;
81+ setHelpString ( blockInstance , helpText ) ;
82+ }
83+
7884 // Refactor TurtleHeapBlock
7985 class TurtleHeapBlock extends LeftBlock {
8086 constructor ( ) {
8187 super ( "turtleheap" , _THIS_IS_MUSIC_BLOCKS_ ? _ ( "mouse index heap" ) : _ ( "turtle index heap" ) ) ;
82- this . setPalette ( "ensemble" , activity ) ;
83-
84- const helpText = _THIS_IS_MUSIC_BLOCKS_
88+ initializeBlock ( this , "ensemble" , _THIS_IS_MUSIC_BLOCKS_
8589 ? [ _ ( "The Mouse index heap block returns a value in the heap at a specified location for a specified mouse." ) , "documentation" , "" ]
86- : [ _ ( "The Turtle index heap block returns a value in the heap at a specified location for a specified turtle." ) , "documentation" , "" ] ;
87- setHelpString ( this , helpText ) ;
90+ : [ _ ( "The Turtle index heap block returns a value in the heap at a specified location for a specified turtle." ) , "documentation" , "" ] ) ;
8891
8992 const formOptions = {
9093 args : 2 ,
You can’t perform that action at this time.
0 commit comments