Started work on serialization, refactoring

This commit is contained in:
barsdeveloper
2021-10-05 17:26:34 +02:00
parent 5032289e86
commit e8d9963a18
10 changed files with 283 additions and 19 deletions

22
js/UGraphEntity.js Normal file
View File

@@ -0,0 +1,22 @@
/**
* A Graph Entity is an element that can stay directly (as a first child) on the blueprint grid. Those entities are either nodes or links
*/
export default class UGraphEntity extends HTMLElement {
constructor() {
super()
/** @type {import("./UEBlueprint").default}" */
this.blueprint = null
}
connectedCallback() {
this.blueprint = this.closest('u-blueprint')
let aDiv = document.createElement('div')
aDiv.innerHTML = this.render()
this.appendChild(aDiv.firstElementChild)
}
// Subclasses want to rewrite this
render() {
return ""
}
}