Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { getCorrectEventName } from '@material/animation/dist/mdc.animation';
import { MDCCheckboxFoundation } from '@material/checkbox/dist/mdc.checkbox';
import React, { PureComponent, PropTypes } from 'react';
const BROWSER_ANIMATION_END_EVENT_NAME = getCorrectEventName(window, 'animationend');
export default class Checkbox extends PureComponent {
static propTypes = {
className: PropTypes.string,
checked: PropTypes.bool,
indeterminate: PropTypes.bool,
disabled: PropTypes.bool,
onChange: PropTypes.func,
};
static defaultProps = {
className: '',
checked: false,
indeterminate: false,
disabled: false,
onChange: () => {},
this.element.setState((state) => ({
foundationEventListeners: state.foundationEventListeners.update(
getCorrectEventName(window, "animationend"),
OrderedSet(),
(x) => x.add(handler),
),
}));
}
public deregisterAnimationEndHandler(handler: EventListener) {
const evt = getCorrectEventName(window, "animationend");
if (this.element.state.foundationEventListeners.get(evt).includes(handler)) {
this.element.setState((state) => ({
foundationEventListeners: state.foundationEventListeners.delete(evt),
}));
}
}
public forceLayout() {
registerAnimationEndHandler: handler => {
if (this.refs.root) {
this.refs.root.addEventListener(getCorrectEventName(window, 'animationend'), handler);
}
},
deregisterAnimationEndHandler: handler => {
deregisterAnimationEndHandler: handler => {
if (this.refs.root) {
this.refs.root.removeEventListener(getCorrectEventName(window, 'animationend'), handler)
}
},
registerChangeHandler: handler => {