Skip to content

eufy-mega / client/eufy-mega / AnyDeviceEvent

Type Alias: AnyDeviceEvent

ts
type AnyDeviceEvent = { [K in keyof DeviceEventMap]: DeviceEventMap[K] & { eventName: K } }[keyof DeviceEventMap];

A single semantic event tagged with its name — the payload of the catch-all "event" listener. A discriminated union over DeviceEventMap, so switching on e.eventName narrows e to that event's payload. Lets a consumer fan every device event to one bus/handler without registering a listener per name (eufy.on("event", e => bus.emit(e.eventName, e))).

The tag is eventName, not name: an event payload may legitimately carry its own name field, and overwriting it to tag the event would destroy data. Matches the eventName carried on a push event.

Independent and unofficial. Not affiliated with, endorsed by, or sponsored by Anker Innovations or eufy. "eufy" and "Anker" are trademarks of their respective owners. Use responsibly — rapid or failed logins can trigger captcha or temporary cooldowns.