From 3ddbd37ade2e03e4fc3a6f5ba52234bc286fded3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 13 Dec 2021 02:26:36 +0100 Subject: Made VEventComponent template optional. --- static/components/vevent-description.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'static/components/vevent-description.ts') diff --git a/static/components/vevent-description.ts b/static/components/vevent-description.ts index 98c9007e..4d81d6b3 100644 --- a/static/components/vevent-description.ts +++ b/static/components/vevent-description.ts @@ -8,10 +8,18 @@ import { makeElement } from '../lib' */ class ComponentDescription extends ComponentVEvent { + + constructor(uid?: string) { + super(uid); + if (!this.template) { + throw 'vevent-description template required'; + } + } + redraw(data: VEvent) { // update ourselves from template - let body = (this.template.content.cloneNode(true) as DocumentFragment).firstElementChild!; + let body = (this.template!.content.cloneNode(true) as DocumentFragment).firstElementChild!; for (let el of body.querySelectorAll('[data-property]')) { if (!(el instanceof HTMLElement)) continue; -- cgit v1.2.3