diff --git a/lul/ewag.jpg b/lul/ewag.jpg deleted file mode 100755 index 3c1fbd31..00000000 Binary files a/lul/ewag.jpg and /dev/null differ diff --git a/lul/index.html b/lul/index.html deleted file mode 100644 index 020a43a7..00000000 --- a/lul/index.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - diff --git a/lul/jakearchibald.jpg b/lul/jakearchibald.jpg deleted file mode 100755 index dd56c73c..00000000 Binary files a/lul/jakearchibald.jpg and /dev/null differ diff --git a/lul/jasonjmiller.jpg b/lul/jasonjmiller.jpg deleted file mode 100755 index 03cad58b..00000000 Binary files a/lul/jasonjmiller.jpg and /dev/null differ diff --git a/lul/kosamari.jpg b/lul/kosamari.jpg deleted file mode 100755 index 797be275..00000000 Binary files a/lul/kosamari.jpg and /dev/null differ diff --git a/lul/surma.jpg b/lul/surma.jpg deleted file mode 100755 index 9247c343..00000000 Binary files a/lul/surma.jpg and /dev/null differ diff --git a/src/components/App/index.tsx b/src/components/App/index.tsx index ca4fa144..0e5a1e9d 100644 --- a/src/components/App/index.tsx +++ b/src/components/App/index.tsx @@ -107,11 +107,25 @@ export default class App extends Component { private exposeAPI() { const api = { - setFile: (blob: Blob, name: string) => { - return new Promise((resolve) => { - this.setState({ file: new File([blob], name) }); - document.addEventListener('squooshingdone', () => resolve(), { once: true }); + setFile: async (blob: Blob, name: string) => { + let oldCompressorState = this.compressInstance && this.compressInstance.state; + await new Promise((resolve) => { + this.setState({ file: new File([blob], name) }, resolve); }); + await new Promise((resolve) => { + document.addEventListener('squooshingdone', resolve, { once: true }); + }); + if (oldCompressorState) { + let newState = this.compressInstance!.state; + [0, 1].forEach((index) => { + oldCompressorState = cleanMerge(oldCompressorState!, `images.${index}`, { + loading: false, + data: undefined, + }); + newState = cleanSet(newState, `images.${index}`, oldCompressorState.images[index]); + }); + this.compressInstance!.setState(newState); + } }, getBlob: async (side: 0 | 1) => { if (!this.state.file || !this.compressInstance) {