mirror of
https://github.com/misode/misode.github.io.git
synced 2026-04-25 08:06:51 +00:00
Add conditional rendering
This commit is contained in:
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user