Files
karma/ui/src/Components/FetchPauser/index.js
2018-09-24 15:28:25 +01:00

32 lines
672 B
JavaScript

import { Component } from "react";
import PropTypes from "prop-types";
import { inject } from "mobx-react";
import { AlertStore } from "Stores/AlertStore";
const FetchPauser = inject("alertStore")(
class FetchPauser extends Component {
static propTypes = {
children: PropTypes.any,
alertStore: PropTypes.instanceOf(AlertStore).isRequired
};
componentDidMount() {
const { alertStore } = this.props;
alertStore.status.pause();
}
componentWillUnmount() {
const { alertStore } = this.props;
alertStore.status.resume();
}
render() {
return this.props.children;
}
}
);
export { FetchPauser };