mirror of
https://github.com/prymitive/karma
synced 2026-05-19 04:26:41 +00:00
32 lines
672 B
JavaScript
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 };
|