-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPigController.js
29 lines (29 loc) · 920 Bytes
/
PigController.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
System.register([], function (exports_1, context_1) {
"use strict";
var PigController;
var __moduleName = context_1 && context_1.id;
return {
setters: [],
execute: function () {
//Format copied from Professors Youtube tutorial
PigController = class PigController {
constructor() {
this.pigs = [];
}
addPig(pig) {
this.pigs.push(pig);
}
removePig(pigId) {
const index = this.pigs.findIndex((pig) => pig.id === pigId);
if (index !== -1) {
this.pigs.splice(index, 1);
}
}
getPigs() {
return this.pigs;
}
};
exports_1("PigController", PigController);
}
};
});