HotUpdater.addEventListener()The addEventListener function allows you to listen for specific events emitted by the HotUpdater. This is useful for tracking update progress or other events during the update process.
For most use cases involving bundle download progress bar displays, it's more convenient to use the store hook instead of this listener. See useHotUpdaterStore.
Use addEventListener to subscribe to HotUpdater events. It returns an unsubscribe function to clean up the listener when it's no longer needed.
The HotUpdaterEvent type defines the available events and their corresponding payloads.
| Parameter | Type | Required | Description | 
|---|---|---|---|
eventName | keyof HotUpdaterEvent | ✅ | The name of the event to listen for. | 
listener | (event: HotUpdaterEvent[T]) => void | ✅ | The callback function to handle the event. | 
The addEventListener function returns a cleanup function that removes the event listener when called.
Here's an example of how to use addEventListener in a React Native component: