js-image-compressor
js-image-compressor copied to clipboard
add typescript definition and fix this is undefined
Thanks for this package.
I found issues when I using this package. So I want to fix them.
In the first commit, I add a typescript definition for this package, then we don't need to write a extra definition file for this package.
In the second commit, I fix a bug in the error callback. When Image onerror method call, "this.options" in error method will be undefined (Because we call it in onerror callback). So I add a .bind(_this)
to fix this bug.