diff --git a/lib/downloadTask.js b/lib/downloadTask.js index b8d8310..4836841 100644 --- a/lib/downloadTask.js +++ b/lib/downloadTask.js @@ -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 () {