aboutsummaryrefslogtreecommitdiff
path: root/static/rrule.js
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-11-23 21:37:03 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2020-11-23 21:37:03 +0100
commit0ff627bca9739fb3d0c8c4f820bc052fc6dd108e (patch)
treef4314589b48a62b0c55ea2f271cd70939cabd035 /static/rrule.js
parentNotes on input-list doc. (diff)
downloadcalp-0ff627bca9739fb3d0c8c4f820bc052fc6dd108e.tar.gz
calp-0ff627bca9739fb3d0c8c4f820bc052fc6dd108e.tar.xz
Bind large part of rrule.
Diffstat (limited to '')
-rw-r--r--static/rrule.js22
1 files changed, 16 insertions, 6 deletions
diff --git a/static/rrule.js b/static/rrule.js
index 30bed919..8f3693a6 100644
--- a/static/rrule.js
+++ b/static/rrule.js
@@ -1,13 +1,23 @@
+function recur_xml_to_rrule(dom_element) {
+ let rr = new RRule;
+ for (let child of dom_element.children) {
+ let key = child.tagName; /* freq */
+ let val = child.innerHTML; /* weekly */
+ rr[key] = val;
+ }
+ return rr;
+}
+
class RRule {
/* direct access to fields is fine */
/* setting them however requires methods, since there might
be listeners */
- const fields = ['freq', 'until', 'count', 'interval',
- 'bysecond', 'byminute', 'byhour',
- 'bymonthday', 'byyearday', 'byweekno',
- 'bymonth', 'bysetpos', 'wkst']
+ fields = ['freq', 'until', 'count', 'interval',
+ 'bysecond', 'byminute', 'byhour',
+ 'bymonthday', 'byyearday', 'byweekno',
+ 'bymonth', 'bysetpos', 'wkst']
constructor() {
@@ -17,7 +27,7 @@ class RRule {
this[f] = false;
Object.defineProperty(
this, f, {
- get: () => this['_' + f];
+ get: () => this['_' + f],
set: (v) => {
this['_' + f] = v
for (let l of this.listeners[f]) {
@@ -30,7 +40,7 @@ class RRule {
}
addListener(field, proc) {
- this.listeners[field].append(proc);
+ this.listeners[field].push(proc);
}
asXcal() {