Donaldcwl / browser-image-compression

Image compression in web browser
MIT License
1.3k stars 160 forks source link

onProgress error from 1.0.7 onwards #50

Closed kaYcee closed 4 years ago

kaYcee commented 4 years ago

Very useful lib! But since upgrading from version 1.0.6 to 1.0.7 I have been receiving the following error:

index.js:70 Uncaught TypeError: n.onProgress is not a function at Worker.handler

I could track the issue down to the new onProgress option. It seems that the default value is not working as expected when custom options are provided without an onProgress handler, e.g.:

options={{
   maxSizeMB: 600 / 1024,
   maxWidthOrHeight: 600,
   useWebWorker: true,
   maxIteration: 10,
   fileType: 'image/jpeg',
}}

My current workaround is to add

onProgress: () => null

to the options object.

kopax commented 4 years ago

I also have this issue. Thanks for the workaround!