Events
Available Events
onError: (error: string) => void
Event triggered when an error occurs
onDownloadProgress: (downloads: Array<DownloadStatus>) => void
Event triggered per given period of time (see configuration)
see DownloadStatus
onDownloadEnd: (download: DownloadStatus) => void
Event triggered when a download ends
see DownloadStatus
How to use events
Events are fully types so you will see autocompletion and type safety when using them.
import { useEvent } from '@twg/react-native-video-stream-downloader';
useEvent('onError', (error: string) => {
console.log(error);
});
useEvent('onDownloadProgress', (downloads: Array<DownloadStatus>) => {
console.log(downloads);
});
useEvent('onDownloadEnd', (download: DownloadStatus) => {
console.log(download);
});