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

Linting and Prettify: All files in js/turtleactions #2831

Merged
merged 9 commits into from
Feb 11, 2021
4 changes: 1 addition & 3 deletions js/turtleactions/DictActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@
js/turtle.js
Turtle
js/activity.js
turtles
turtles, logo
js/turtle-singer.js
Singer
js/utils/musicutils.js
getNote, pitchToNumber
js/activity.js
logo
js/logo.js
INVALIDPITCH
js/blocks/EnsembleBlocks.js
Expand Down
40 changes: 31 additions & 9 deletions js/turtleactions/DrumActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,35 @@
*
* Utility methods are in PascalCase.
* Action methods are in camelCase.
*/

/*
global Singer, DEFAULTDRUM, DRUMNAMES, last, DEFAULTVOLUME, logo, blocks, MusicBlocks, Mouse,
NOISENAMES, _
*/

/*
Global Locations
js/utils/utils.js
_
js/turtle-singer.js
Singer
js/activity.js
logo, blocks
js/utils/synthutils.js
DRUMNAMES, NOISENAMES
js/utils/musicutils.js
DEFAULTDRUM
js/logo.js/
DEFAULTVOLUME
js/js-export/export.js
MusicBlocks, Mouse
*/

/* exported setupDrumActions */

/**
* Sets up all the methods related to different actions for each block in Drum palette.
*
* @returns {void}
*/
function setupDrumActions() {
Expand Down Expand Up @@ -82,8 +106,8 @@ function setupDrumActions() {

const noteBeatValue = 4;

const __callback =
() => tur.singer.inNoteBlock.splice(tur.singer.inNoteBlock.indexOf(blk), 1);
const __callback = () =>
tur.singer.inNoteBlock.splice(tur.singer.inNoteBlock.indexOf(blk), 1);

Singer.processNote(noteBeatValue, false, blk, turtle, __callback);
}
Expand Down Expand Up @@ -117,11 +141,10 @@ function setupDrumActions() {
logo.setDispatchBlock(blk, turtle, listenerName);
} else if (MusicBlocks.isRun) {
const mouse = Mouse.getMouseFromTurtle(tur);
if (mouse !== null)
mouse.MB.listeners.push(listenerName);
if (mouse !== null) mouse.MB.listeners.push(listenerName);
}

const __listener = event => {
const __listener = () => {
tur.singer.drumStyle.pop();
tur.singer.pitchDrumTable = {};
};
Expand Down Expand Up @@ -160,11 +183,10 @@ function setupDrumActions() {
logo.setDispatchBlock(blk, turtle, listenerName);
} else if (MusicBlocks.isRun) {
const mouse = Mouse.getMouseFromTurtle(tur);
if (mouse !== null)
mouse.MB.listeners.push(listenerName);
if (mouse !== null) mouse.MB.listeners.push(listenerName);
}

const __listener = event => tur.singer.drumStyle.pop();
const __listener = () => tur.singer.drumStyle.pop();

logo.setTurtleListener(turtle, listenerName, __listener);
if (logo.inRhythmRuler) {
Expand Down
38 changes: 14 additions & 24 deletions js/turtleactions/IntervalsActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,30 @@
*/

/*
global _, logo, NOINPUTERRORMSG, Singer, blocks, MUSICALMODES, MusicBlocks, Mouse,
MODE_PIE_MENUS, getNote, getModeLength
*/
global _, logo, NOINPUTERRORMSG, Singer, blocks, MUSICALMODES, MusicBlocks, Mouse, getNote,
getModeLength
*/

/*
Global locations
- js/utils/utils.js
js/utils/utils.js
_
- js/logo.js
NOINPUTERRORMSG
- js/utils/musicutils.js
MUSICALMODES, MODE_PIE_MENUS, getNote, getModeLength
- js/turtle-singer.js
Singer
- js/activity.js
blocks, logo
- js/js-export/export.js
MusicBlocks, Mouse
js/logo.js
NOINPUTERRORMSG
js/utils/musicutils.js
MUSICALMODES, MODE_PIE_MENUS, getNote, getModeLength
js/turtle-singer.js
Singer
js/activity.js
blocks, logo
js/js-export/export.js
MusicBlocks, Mouse
*/

/* exported setupIntervalsActions*/

/**
* Sets up all the methods related to different actions for each block in Intervals palette.
*
* @returns {void}
*/
function setupIntervalsActions() {
Expand Down Expand Up @@ -183,15 +182,6 @@ function setupIntervalsActions() {
}

const __listener = () => {
if (MODE_PIE_MENUS["12"].indexOf(modeName) === -1) {
const index = MODE_PIE_MENUS["12"].indexOf(" ");
if (index === -1) {
logo.errorMsg(_("Cannot add new mode to Pie Menu."));
} else {
MODE_PIE_MENUS["12"][index] = modeName;
}
}

MUSICALMODES[modeName] = [];
if (tur.singer.defineMode.indexOf(0) === -1) {
tur.singer.defineMode.push(0);
Expand Down
Loading