Fix crash in old browsers (#15985)

Fixes #15984
master
Claire 4 years ago committed by GitHub
parent ddabbbf5a6
commit abad99fa10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      app/javascript/mastodon/features/ui/components/columns_area.js

@ -90,7 +90,11 @@ class ColumnsArea extends ImmutablePureComponent {
} }
if (this.mediaQuery) { if (this.mediaQuery) {
this.mediaQuery.addEventListener('change', this.handleLayoutChange); if (this.mediaQuery.addEventListener) {
this.mediaQuery.addEventListener('change', this.handleLayoutChange);
} else {
this.mediaQuery.addListener(this.handleLayoutChange);
}
this.setState({ renderComposePanel: !this.mediaQuery.matches }); this.setState({ renderComposePanel: !this.mediaQuery.matches });
} }
@ -125,7 +129,11 @@ class ColumnsArea extends ImmutablePureComponent {
} }
if (this.mediaQuery) { if (this.mediaQuery) {
this.mediaQuery.removeEventListener('change', this.handleLayoutChange); if (this.mediaQuery.removeEventListener) {
this.mediaQuery.removeEventListener('change', this.handleLayoutChange);
} else {
this.mediaQuery.removeListener(this.handleLayouteChange);
}
} }
} }

Loading…
Cancel
Save