diff --git a/for-js/Velopack.js b/for-js/Velopack.js index c0c7b37..f21f6b7 100644 --- a/for-js/Velopack.js +++ b/for-js/Velopack.js @@ -1200,9 +1200,11 @@ class UpdateManager extends UpdateManagerSync { async downloadUpdatesAsync(toDownload, progress) { const command = this.getDownloadUpdatesCommand(toDownload); await nativeStartProcessAsyncReadLine(command, (data) => { - const p = parseInt(data); - if (!isNaN(p) && p > 0) { - progress(p); + if (progress && progress instanceof Function) { + const p = parseInt(data); + if (!isNaN(p) && p > 0) { + progress(p); + } } }); } diff --git a/for-js/Velopack.ts b/for-js/Velopack.ts index 3cf8638..50b159e 100644 --- a/for-js/Velopack.ts +++ b/for-js/Velopack.ts @@ -1331,9 +1331,11 @@ export class UpdateManager extends UpdateManagerSync { ): Promise { const command: string[] = this.getDownloadUpdatesCommand(toDownload); await nativeStartProcessAsyncReadLine(command, (data: string) => { - const p = parseInt(data); - if (!isNaN(p) && p > 0) { - progress(p); + if (progress && progress instanceof Function) { + const p = parseInt(data); + if (!isNaN(p) && p > 0) { + progress(p); + } } }); } diff --git a/src/include/ts_end.ts b/src/include/ts_end.ts index f435f46..b34a054 100644 --- a/src/include/ts_end.ts +++ b/src/include/ts_end.ts @@ -36,9 +36,11 @@ export class UpdateManager extends UpdateManagerSync { public async downloadUpdatesAsync(toDownload: VelopackAsset, progress: (arg: number) => void): Promise { const command: string[] = this.getDownloadUpdatesCommand(toDownload); await nativeStartProcessAsyncReadLine(command, (data: string) => { - const p = parseInt(data); - if (!isNaN(p) && p > 0) { - progress(p); + if (progress && progress instanceof Function) { + const p = parseInt(data); + if (!isNaN(p) && p > 0) { + progress(p); + } } }); }