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:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user