Make images smaller using best-in-class codecs, right in the browser.
JavaScript
Remove lambda from JSX
Surmae8c0ddfc7fd4
diff --git a/src/codecs/imagequant/options.tsx b/src/codecs/imagequant/options.tsxindex 5ea1c0fd..7dc2cb6f 100644--- a/src/codecs/imagequant/options.tsx+++ b/src/codecs/imagequant/options.tsx@@ -48,6 +48,7 @@ export default class QuantizerOptions extends Component<Props, {}> {type="range"min="0"max="1"+ step="0.01"value={'' + options.dither}onChange={this.onChange}/>diff --git a/src/components/Options/index.tsx b/src/components/Options/index.tsxindex 7ddf5427..22a0f42f 100644--- a/src/components/Options/index.tsx+++ b/src/components/Options/index.tsx@@ -6,7 +6,7 @@ import BrowserJPEGEncoderOptions from '../../codecs/browser-jpeg/options';import WebPEncoderOptions from '../../codecs/webp/options';import BrowserWebPEncoderOptions from '../../codecs/browser-webp/options';-import QuantizerOptions from '../../codecs/imagequant/options';+import QuantizerOptionsComponent from '../../codecs/imagequant/options';import * as identity from '../../codecs/identity/encoder';import * as mozJPEG from '../../codecs/mozjpeg/encoder';@@ -28,6 +28,7 @@ import {EncoderSupportMap,PreprocessorState,} from '../../codecs/encoders';+import { QuantizeOptions } from '../../codecs/imagequant/quantizer';const encoderOptionsComponentMap = {[identity.type]: undefined,@@ -85,6 +86,17 @@ export default class Options extends Component<Props, State> {this.props.onPreprocessorOptionsChange(preprocessorState);}+ @bind+ onQuantizerOptionsChange(opts: QuantizeOptions) {+ this.props.onPreprocessorOptionsChange({+ ...this.props.preprocessorState,+ quantizer: {+ ...opts,+ enabled: this.props.preprocessorState.quantizer.enabled,+ },+ });+ }+render({ class: className, encoderState, preprocessorState, onEncoderOptionsChange }: Props,{ encoderSupportMap }: State,@@ -105,16 +117,9 @@ export default class Options extends Component<Props, State> {Enable</label>{preprocessorState.quantizer.enabled ? (- <QuantizerOptions+ <QuantizerOptionsComponentoptions={preprocessorState.quantizer}- // tslint:disable-next-line:jsx-no-lambda- onChange={quantizeOpts => this.props.onPreprocessorOptionsChange({- ...preprocessorState,- quantizer: {- ...quantizeOpts,- enabled: preprocessorState.quantizer.enabled,- },- })}+ onChange={this.onQuantizerOptionsChange}/>) : (<div/>