-
Notifications
You must be signed in to change notification settings - Fork 0
/
report.ts
35 lines (29 loc) · 952 Bytes
/
report.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
var table: HTMLElement;
export function log(...data: any[]): void {
const pre = document.createElement('pre');
pre.innerText = data.join(" ").toString();
document.body.append(pre);
}
export function beginTable(title: string, rowHeaders: string[]): void {
const h1 = document.createElement('h3');
h1.innerText = title;
document.body.append(h1);
table = document.createElement('table');
var tr = document.createElement('tr');
for (const cell of rowHeaders) {
var td = document.createElement('th');
td.innerText = cell.toString();
tr.appendChild(td);
}
table.appendChild(tr);
document.body.appendChild(table);
}
export function addRow(row: any[]): void {
var tr = document.createElement('tr');
for (const cell of row) {
var td = document.createElement('td');
td.innerText = cell.toString();
tr.appendChild(td);
}
table.appendChild(tr);
}