fix safeguard functions

This commit is contained in:
Kesha Antonov
2023-01-30 14:43:47 +03:00
parent 2bd81f0be0
commit b7dfbe24cc
+4 -4
View File
@@ -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 () {