aboutsummaryrefslogtreecommitdiff
path: root/static/components
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-07-10 14:56:19 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-07-10 16:46:10 +0200
commitab3342171fba016b0c5f19b860336ed49a08f3fb (patch)
tree8a1d6c72fccca64da68ae74eaf046e91d227ce8d /static/components
parentAdd srfi-64 util. (diff)
downloadcalp-ab3342171fba016b0c5f19b860336ed49a08f3fb.tar.gz
calp-ab3342171fba016b0c5f19b860336ed49a08f3fb.tar.xz
Change JS formatters interface.
Now the application of formatters are centralized. It also allowed me to easily suround stuff in try-catch, since I otherwise had problems with formatters failing, and nothing showing up.
Diffstat (limited to 'static/components')
-rw-r--r--static/components/vevent-description.ts11
1 files changed, 2 insertions, 9 deletions
diff --git a/static/components/vevent-description.ts b/static/components/vevent-description.ts
index 463725f1..b44185e7 100644
--- a/static/components/vevent-description.ts
+++ b/static/components/vevent-description.ts
@@ -2,7 +2,7 @@ export { ComponentDescription }
import { VEvent } from '../vevent'
import { ComponentVEvent } from './vevent'
-import { formatters } from '../formatters'
+import { format } from '../formatters'
/*
<vevent-description />
@@ -23,14 +23,7 @@ class ComponentDescription extends ComponentVEvent {
for (let el of body.querySelectorAll('[data-property]')) {
if (!(el instanceof HTMLElement)) continue;
- let p = el.dataset.property!;
- let d;
- if ((d = data.getProperty(p))) {
- let key = p.toLowerCase();
- let f = formatters.get(key);
- if (f) f(el, data, d);
- else window.formatters.get('default')!(el, data, d);
- }
+ format(el, data, el.dataset.property!);
}
let repeating = body.getElementsByClassName('repeating')[0] as HTMLElement