aboutsummaryrefslogtreecommitdiff
path: root/static/vevent.ts
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-11-18 21:40:19 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2021-11-18 21:40:19 +0100
commite5d682702f6954ebab946ca0eb67ab22f465f6ea (patch)
tree34373f2f20154f6fcbfb4e534c69ff55fa23715c /static/vevent.ts
parentRemove .interactive, fix date-time checkbox. (diff)
downloadcalp-e5d682702f6954ebab946ca0eb67ab22f465f6ea.tar.gz
calp-e5d682702f6954ebab946ca0eb67ab22f465f6ea.tar.xz
Add setProperties, add type info to setProperty.
Diffstat (limited to 'static/vevent.ts')
-rw-r--r--static/vevent.ts30
1 files changed, 23 insertions, 7 deletions
diff --git a/static/vevent.ts b/static/vevent.ts
index 307c572f..0c262208 100644
--- a/static/vevent.ts
+++ b/static/vevent.ts
@@ -106,11 +106,15 @@ class VEvent {
return this.properties.keys()
}
- setProperty(key: string, value: any) {
+ __setPropertyInternal(key: string, value: any, type?: ical_type) {
key = key.toUpperCase();
let e = this.properties.get(key);
- if (!e) {
- let type: ical_type
+ if (e) {
+ if (type) { e.type = type; }
+ e.value = value;
+ return;
+ }
+ if (!type) {
let type_ = valid_input_types.get(key)
if (type_ === undefined) {
type = 'unknown'
@@ -119,16 +123,28 @@ class VEvent {
} else {
type = type_
}
- e = new VEventValue(type, value)
- this.properties.set(key, e);
- } else {
- e.value = value;
+ }
+ e = new VEventValue(type, value)
+ this.properties.set(key, e);
+ }
+
+ setProperty(key: string, value: any, type?: ical_type) {
+ this.__setPropertyInternal(key, value, type);
+ for (let el of this.registered) {
+ el.redraw(this);
+ }
+ }
+
+ setProperties(pairs: [string, any, ical_type?][]) {
+ for (let pair of pairs) {
+ this.__setPropertyInternal(...pair);
}
for (let el of this.registered) {
el.redraw(this);
}
}
+
set calendar(calendar: string | null) {
this._calendar = calendar;
for (let el of this.registered) {