* Get the thing's events as an array. * * @param {String?} eventName Optional event name to get descriptions for * * @returns {Object} Event descriptions.
(eventName?: string|null)
| 290 | * @returns {Object} Event descriptions. |
| 291 | */ |
| 292 | getEventDescriptions(eventName?: string|null): Event.EventDescription[] { |
| 293 | if (!eventName) { |
| 294 | return this.events.map((e) => e.asEventDescription()); |
| 295 | } else { |
| 296 | return this.events. |
| 297 | filter((e) => e.getName() === eventName). |
| 298 | map((e) => e.asEventDescription()); |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | /** |
| 303 | * Add a property to this thing. |
no test coverage detected