Make images smaller using best-in-class codecs, right in the browser.
JavaScript
Add explanation on infinite loop bug
Surma19342208d284
diff --git a/src/lib/codec-wrappers/mozjpeg-enc.ts b/src/lib/codec-wrappers/mozjpeg-enc.tsindex 3077bad1..f39fdaa6 100644--- a/src/lib/codec-wrappers/mozjpeg-enc.ts+++ b/src/lib/codec-wrappers/mozjpeg-enc.ts@@ -31,7 +31,11 @@ export class MozJpegEncoder implements Encoder {return url;},onRuntimeInitialized() {- // This is a bug I discovered. To be filed.+ // An Emscripten is a then-able that, for some reason, `then()`s itself,+ // causing an infite loop when you wrap it in a real promise. Deleten the `then`+ // prop solves this for now.+ // See: https://github.com/kripken/emscripten/blob/incoming/src/postamble.js#L129+ // TODO(surma@): File a bug with Emscripten on this.delete (m as any).then;resolve(m);}