Add conditional rendering

This commit is contained in:
Misode
2020-05-26 17:25:42 +02:00
parent a6661a8563
commit 8371e43276
9 changed files with 64 additions and 25 deletions

View File

@@ -24,6 +24,15 @@ export class DataModel {
this.listeners.forEach(listener => listener.invalidated(this))
}
get(path: Path) {
let node = this.data;
for (let index of path) {
if (node === undefined) return node
node = node[index]
}
return node
}
set(path: Path, value: any) {
let node = this.data;
for (let index of path.pop()) {