mirror of
https://github.com/zoriya/react-native-background-downloader.git
synced 2026-05-25 15:29:18 +00:00
fix safeguard functions
This commit is contained in:
+4
-4
@@ -57,24 +57,24 @@ export default class DownloadTask {
|
||||
|
||||
onBegin ({ expectedBytes, headers }) {
|
||||
this.state = 'DOWNLOADING'
|
||||
this?.beginHandler({ expectedBytes, headers })
|
||||
this.beginHandler?.({ expectedBytes, headers })
|
||||
}
|
||||
|
||||
onProgress (percent, bytesWritten, totalBytes) {
|
||||
this.percent = percent
|
||||
this.bytesWritten = bytesWritten
|
||||
this.totalBytes = totalBytes
|
||||
this?.progressHandler(percent, bytesWritten, totalBytes)
|
||||
this.progressHandler?.(percent, bytesWritten, totalBytes)
|
||||
}
|
||||
|
||||
onDone ({ location }) {
|
||||
this.state = 'DONE'
|
||||
this?.doneHandler({ location })
|
||||
this.doneHandler?.({ location })
|
||||
}
|
||||
|
||||
onError (error, errorCode) {
|
||||
this.state = 'FAILED'
|
||||
this?.errorHandler(error, errorCode)
|
||||
this.errorHandler?.(error, errorCode)
|
||||
}
|
||||
|
||||
pause () {
|
||||
|
||||
Reference in New Issue
Block a user