1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-06 12:02:45 +03:00

Comments & Pointer: Converted components to typescript

Made changes for dom and translation services for easier usage
considering types.
trans_choice updated to allow default count replacement data as per
Laravel's default behaviour.
This commit is contained in:
Dan Brown
2025-04-18 20:42:56 +01:00
parent 8d159f77e4
commit add238fe9f
4 changed files with 98 additions and 46 deletions

View File

@@ -44,9 +44,11 @@ export function forEach(selector: string, callback: (el: Element) => any) {
/**
* Helper to listen to multiple DOM events
*/
export function onEvents(listenerElement: Element, events: string[], callback: (e: Event) => any): void {
for (const eventName of events) {
listenerElement.addEventListener(eventName, callback);
export function onEvents(listenerElement: Element|null, events: string[], callback: (e: Event) => any): void {
if (listenerElement) {
for (const eventName of events) {
listenerElement.addEventListener(eventName, callback);
}
}
}