aboutsummaryrefslogtreecommitdiff
path: root/static/ts/components/vevent.ts
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--static/ts/components/vevent.ts (renamed from static/components/vevent.ts)44
1 files changed, 40 insertions, 4 deletions
diff --git a/static/components/vevent.ts b/static/ts/components/vevent.ts
index 7487cbb6..50ff4a30 100644
--- a/static/components/vevent.ts
+++ b/static/ts/components/vevent.ts
@@ -1,18 +1,48 @@
+/**
+ * Root component for all events which content is closely linked to a `VEvent` object
+ *
+ * Lacks an accompaning tag, and shouldn't be directly instanciated.
+ *
+ * Note that many of these assume that their initial children are
+ * configured specifically, that is however not completely documented.
+ *
+ * @category Web Components
+ * @mergeTarget components
+ * @module
+ */
+
export { ComponentVEvent }
import { vcal_objects } from '../globals'
import { VEvent } from '../vevent'
-/* Root component for all events which content is closely linked to a
-@code{VEvent} object
+/**
+ Base class for all Web Components closely linked with VEvents.
+
+ TODO document how templates work.
-Lacks an accompaning tag, and shouldn't be directly instanciated.
-*/
+ TODO document lifecycle, and how objects are fetched from the "global" store.
+ */
abstract class ComponentVEvent extends HTMLElement {
+ /**
+ The template for this event.
+
+ TODO document how this is populate
+ */
template?: HTMLTemplateElement
+
+ /** The UID of the VEvent we are tracking */
uid: string
+ /**
+ * This registeres itself, but doesn't redraw
+ * We do however redraw in connectedCallback
+
+ * @privateRemarks
+ * TODO what is done in the default constructor,
+ * and the default connectedCallback
+ */
constructor(uid?: string) {
super();
this.template = document.getElementById(this.tagName.toLowerCase()) as HTMLTemplateElement | undefined
@@ -56,6 +86,11 @@ abstract class ComponentVEvent extends HTMLElement {
should take care of that some other way */
}
+ /**
+ Called when the component is mounted.
+
+ Redraws the target if the wanted object is available at that time.
+ */
connectedCallback() {
let uid = this.dataset.uid
if (uid) {
@@ -64,6 +99,7 @@ abstract class ComponentVEvent extends HTMLElement {
}
}
+ /** While abstract for this, @emph{must} be overridden for everyone else */
abstract redraw(data: VEvent): void
}