mirror of https://github.com/vector-im/riot-web
Bind function in constructor.
parent
85fca9dee8
commit
e36d972d94
|
@ -24,13 +24,18 @@ export default class GenericElementContextMenu extends React.Component {
|
||||||
element: PropTypes.element.isRequired,
|
element: PropTypes.element.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.resize = this.resize.bind(this);
|
||||||
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.resize = this.resize.bind(this);
|
this.resize = this.resize.bind(this);
|
||||||
window.addEventListener("resize", this.resize.bind(this));
|
window.addEventListener("resize", this.resize);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
window.removeEventListener("resize", this.resize.bind(this));
|
window.removeEventListener("resize", this.resize);
|
||||||
}
|
}
|
||||||
|
|
||||||
resize() {
|
resize() {
|
||||||
|
|
Loading…
Reference in New Issue