Skip to content

Commit

Permalink
Add getters
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamindehli committed May 25, 2024
1 parent fd0ba3d commit f3ebe60
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/classes/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ export class Button {
getStateItems() {
return this.childElements?.filter((childElement) => childElement instanceof State);
}
getStateItemByIndex(index) {
return this.getStateItems()[index];
}
toJson(decentSampler) {
const jsonObject = {
$: {
Expand Down
3 changes: 3 additions & 0 deletions src/classes/Midi.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ export class Midi {
getNoteItems() {
return this.childElements?.filter((childElement) => childElement instanceof Note);
}
getNoteItemByIndex(index) {
return this.getNoteItems()[index];
}
toJson(decentSampler) {
const jsonObject = {};
jsonObject["#name"] = this.elementType;
Expand Down
3 changes: 3 additions & 0 deletions src/classes/Note.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ export class Note {
getBindingItems() {
return this.childElements?.filter((childElement) => childElement instanceof Binding);
}
getBindingItemByIndex(index) {
return this.getBindingItems()[index];
}
toJson(decentSampler) {
const jsonObject = {
$: {
Expand Down
3 changes: 3 additions & 0 deletions src/classes/State.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ export class State {
getBindingItems() {
return this.childElements?.filter((childElement) => childElement instanceof Binding);
}
getBindingItemByIndex(index) {
return this.getBindingItems()[index];
}
toJson(decentSampler) {
const jsonObject = {
$: {
Expand Down

0 comments on commit f3ebe60

Please sign in to comment.