aboutsummaryrefslogtreecommitdiff
path: root/static/vevent.ts
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-11-05 21:50:18 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2021-11-05 21:50:18 +0100
commit3afc7d26dcca96925be2e4230b4194a9b335af2b (patch)
treefdf8613f256d3b7a396e4b9deb8c29edf3b7cc0b /static/vevent.ts
parentStart depending on npm. (diff)
downloadcalp-3afc7d26dcca96925be2e4230b4194a9b335af2b.tar.gz
calp-3afc7d26dcca96925be2e4230b4194a9b335af2b.tar.xz
doc updates.
Diffstat (limited to 'static/vevent.ts')
-rw-r--r--static/vevent.ts14
1 files changed, 13 insertions, 1 deletions
diff --git a/static/vevent.ts b/static/vevent.ts
index 0fef9685..377cb6ae 100644
--- a/static/vevent.ts
+++ b/static/vevent.ts
@@ -1,9 +1,11 @@
import { ical_type, valid_input_types, JCal } from './types'
import { uid, parseDate } from './lib'
+
export { VEvent, xml_to_vcal }
"use strict";
+/* Something which can be redrawn */
interface Redrawable extends HTMLElement {
redraw: ((data: VEvent) => void)
}
@@ -63,10 +65,21 @@ class VEventValue {
class VEventDuration extends VEventValue {
}
+/*
+ Abstract representation of a calendar event (or similar).
+All "live" calendar data in the frontend should live in an object of this type.
+ */
class VEvent {
+ /* Calendar properties */
properties: Map<uid, VEventValue>
+
+ /* Children (such as alarms for events) */
components: VEvent[]
+
+ /* HTMLElements which wants to be redrawn when this object changes.
+ Elements can be registered with the @code{register} method.
+ */
registered: Redrawable[]
constructor(properties: Map<uid, VEventValue> = new Map(), components: VEvent[] = []) {
@@ -197,7 +210,6 @@ function make_vevent_value_(value_tag: Element) {
}
}
-/* xml dom object -> class VEvent */
function xml_to_vcal(xml: Element): VEvent {
/* xml MUST have a VEVENT (or equivalent) as its root */
let properties = xml.getElementsByTagName('properties')[0];