From b7dfbe24cce90a95162b602317cc7c65a80ed3ea Mon Sep 17 00:00:00 2001 From: Kesha Antonov Date: Mon, 30 Jan 2023 14:43:47 +0300 Subject: [PATCH] fix safeguard functions --- lib/downloadTask.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 () {