mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-13 09:17:20 +00:00
Simplifying new object creation
This commit is contained in:
@@ -81,18 +81,15 @@ export default class Options extends Component<Props, State> {
|
|||||||
onPreprocessorEnabledChange(event: Event) {
|
onPreprocessorEnabledChange(event: Event) {
|
||||||
const el = event.currentTarget as HTMLInputElement;
|
const el = event.currentTarget as HTMLInputElement;
|
||||||
|
|
||||||
const newPreprocessorState = {
|
const preprocessor = el.name.split('.')[0] as keyof PreprocessorState;
|
||||||
|
|
||||||
|
this.props.onPreprocessorOptionsChange({
|
||||||
...this.props.preprocessorState,
|
...this.props.preprocessorState,
|
||||||
};
|
[preprocessor]: {
|
||||||
|
...this.props.preprocessorState[preprocessor],
|
||||||
const preprocessor = el.name.split('.')[0] as keyof typeof newPreprocessorState;
|
enabled: el.checked,
|
||||||
|
},
|
||||||
newPreprocessorState[preprocessor] = {
|
});
|
||||||
...newPreprocessorState[preprocessor],
|
|
||||||
enabled: el.checked,
|
|
||||||
};
|
|
||||||
|
|
||||||
this.props.onPreprocessorOptionsChange(newPreprocessorState);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@bind
|
@bind
|
||||||
|
|||||||
Reference in New Issue
Block a user