28 lines
573 B
JavaScript
28 lines
573 B
JavaScript
|
"use strict";
|
||
|
|
||
|
class TableView {
|
||
|
constructor(el) {
|
||
|
if(this.el === null || typeof this.el === "undefined") throw new Error(`Expected HTML element as the first argument, but got null or undefined.`);
|
||
|
this.el = el;
|
||
|
this.el_parts = new Map();
|
||
|
}
|
||
|
|
||
|
clear() {
|
||
|
this.el.replaceChildren();
|
||
|
this.el_parts.clear();
|
||
|
}
|
||
|
|
||
|
async switch_table(table_name) {
|
||
|
this.clear();
|
||
|
for await (let tabledef of await globalThis.sysquery.table(table_name)) {
|
||
|
this.append_table(tabledef.peer, tabledef.table);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
append_table(peer, table) {
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export default TableView;
|