Simplified undefined check

This commit is contained in:
Benjamin Claassen 2025-01-17 00:05:01 +01:00
parent 1868b38219
commit 64c345564a
No known key found for this signature in database
GPG Key ID: C5F495EAE56673BF

View File

@ -29,9 +29,7 @@ class EventHandler {
if (this.suppresEvents) return []
this.eventCount++
const returnValue = this.events[event].listeners.map((listener) => {
const returnValue = listener(data)
if (returnValue == undefined) return null
return returnValue
return listener(data) ?? null
})
this.events[event].callCount++
if (this.debugEvents) {