-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathListBoyPOV.ts
35 lines (34 loc) · 1.23 KB
/
ListBoyPOV.ts
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
30
31
32
33
34
35
/**
* this class declares a "point of view"
* but it also can be used to describe the object of the verb too...
*/
class POV implements IRenderSelf{
data: any[]
constructor(
// Admittedly this looks transposed in code,
// but the order is more native to me from language studies
first_singular: any, second_singluar: any, third_singular: any,
first_plural: any, second_plural: any, third_plural: any) {
if (third_plural === undefined) {
throw new Error("POV needs 6 parameters");
}
this.data = [
[first_singular, first_plural],
[second_singluar, second_plural],
[third_singular, third_plural],
]
}
Render(mappers: Mappers) : HTMLElement {
let table = document.createElement("table");
for (const row of this.data) {
let tableRow = document.createElement("tr");
table.appendChild(tableRow);
for (const column of row) {
let tableData = document.createElement("td");
tableRow.appendChild(tableData);
tableData.appendChild(ListBoy.CreateItem(column, mappers));
}
}
return table;
}
}