diff --git a/src/panel/main.ts b/src/panel/main.ts index 7f16566a..9dd7a591 100644 --- a/src/panel/main.ts +++ b/src/panel/main.ts @@ -80,7 +80,7 @@ function calculateFloor(size: PetSize, theme: Theme): number { function handleMouseOver(e: MouseEvent) { var el = e.currentTarget as HTMLDivElement; - allPets.pets().forEach((element) => { + allPets.pets.forEach((element) => { if (element.collision === el) { if (!element.pet.canSwipe()) { return; @@ -185,7 +185,7 @@ export function saveState(stateApi?: VscodeStateApi) { var state = new PetPanelState(); state.petStates = new Array(); - allPets.pets().forEach((petItem) => { + allPets.pets.forEach((petItem) => { state.petStates?.push({ petName: petItem.pet.name(), petColor: petItem.color, @@ -420,7 +420,7 @@ export function petPanelApp( case 'throw-ball': resetBall(); throwBall(); - allPets.pets().forEach((petEl) => { + allPets.pets.forEach((petEl) => { if (petEl.pet.canChase()) { petEl.pet.chase(ballState, canvas); } @@ -444,7 +444,7 @@ export function petPanelApp( break; case 'list-pets': - var pets = allPets.pets(); + var pets = allPets.pets; stateApi?.postMessage({ command: 'list-pets', text: pets @@ -457,7 +457,7 @@ export function petPanelApp( break; case 'roll-call': - var pets = allPets.pets(); + var pets = allPets.pets; // go through every single // pet and then print out their name pets.forEach((pet) => { diff --git a/src/panel/pets.ts b/src/panel/pets.ts index afc74312..30c3273e 100644 --- a/src/panel/pets.ts +++ b/src/panel/pets.ts @@ -47,7 +47,7 @@ export class PetElement { } export interface IPetCollection { - pets(): Array; + pets: Array; push(pet: PetElement): void; reset(): void; seekNewFriends(): string[]; @@ -62,7 +62,7 @@ export class PetCollection implements IPetCollection { this._pets = new Array(0); } - pets() { + public get pets() { return this._pets; } diff --git a/src/test/suite/panel.test.ts b/src/test/suite/panel.test.ts index 9d7dc389..9f0867b3 100644 --- a/src/test/suite/panel.test.ts +++ b/src/test/suite/panel.test.ts @@ -147,7 +147,7 @@ suite('Pets Test Suite', () => { assert.equal(firstPet.petType, petType); assert.equal(firstPet.petColor, PetColor.black); - const createdPets = panel.allPets.pets(); + const createdPets = panel.allPets.pets; assert.notEqual(createdPets.at(0), undefined); assert.equal(createdPets.at(0)?.color, PetColor.black);