import { Component } from 'react';
export class SoftWindowEvent extends Component {
    componentDidMount() {
        this.addEvent(this.props);
    }
    componentDidUpdate(prevProps) {
        if (prevProps.event !== this.props.event ||
            prevProps.handler !== this.props.handler) {
            this.removeEvent(prevProps);
            this.addEvent(this.props);
        }
    }
    componentWillUnmount() {
        this.removeEvent(this.props);
    }
    addEvent({ event, handler }) {
        window.addEventListener(event, handler);
    }
    removeEvent({ event, handler }) {
        window.removeEventListener(event, handler);
    }
    render() {
        return null;
    }
}
//# sourceMappingURL=window_event.js.map