Handle race condition with resize event

This commit is contained in:
Jordan Eldredge 2016-11-28 22:50:10 -08:00
parent 918420b68a
commit fcb90bab8b

View file

@ -11,11 +11,18 @@ class WindowManager extends React.Component {
super(props);
this.windowNodes = [];
this.state = {};
window.addEventListener('resize', this.centerWindows.bind(this));
this.getRef = this.getRef.bind(this);
this.handleMouseDown = this.handleMouseDown.bind(this);
}
componentDidMount() {
window.addEventListener('resize', this.centerWindows.bind(this));
const {innerHeight, innerWidth} = window;
if (innerHeight || innerWidth) {
this.centerWindows();
}
}
centerWindows() {
const {innerHeight, innerWidth} = window;
const state = {};