From 52b7bf7a052d2da6c71db7695dde73716cb0e4e5 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Fri, 16 Sep 2022 21:20:52 +0200 Subject: optional streams (3, less bugs) --- client-web/source/helper.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'client-web/source/helper.ts') diff --git a/client-web/source/helper.ts b/client-web/source/helper.ts index e07fc7a..b05bea5 100644 --- a/client-web/source/helper.ts +++ b/client-web/source/helper.ts @@ -4,12 +4,12 @@ import { PREFS } from "./preferences/mod.ts"; const elem = (s: string) => document.createElement(s) -interface Opts { class?: string[] | string, id?: string, src?: string, onclick?: () => void } +interface Opts { class?: string[] | string, id?: string, src?: string, onclick?: (e: HTMLElement) => void } function apply_opts(e: HTMLElement, o: Opts | undefined) { if (!o) return if (o.id) e.id = o.id - if (o.onclick) e.onclick = o.onclick + if (o.onclick) e.onclick = () => o.onclick!(e) if (typeof o?.class == "string") e.classList.add(o.class) if (typeof o?.class == "object") e.classList.add(...o.class) } -- cgit v1.2.3-70-g09d2