about summary refs log tree commit diff
path: root/app/javascript/flavours
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2021-04-01 00:00:12 +0200
committerClaire <claire.github-309c@sitedethib.com>2021-04-05 14:33:42 +0200
commit6be0b4b014d8520a757c5d0156979eb63bf1f345 (patch)
treec026e7570e205fe44fd5d680a08f51241f99a544 /app/javascript/flavours
parentc901ae77d43bc76afc5c927c82b9b75609fa3a58 (diff)
[Glitch] Fix crash in old browsers
Port abad99fa103246075f364278dfb43a5ed0784075 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours')
-rw-r--r--app/javascript/flavours/glitch/features/ui/components/columns_area.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/javascript/flavours/glitch/features/ui/components/columns_area.js b/app/javascript/flavours/glitch/features/ui/components/columns_area.js
index b41de58d7..4ea7b48fe 100644
--- a/app/javascript/flavours/glitch/features/ui/components/columns_area.js
+++ b/app/javascript/flavours/glitch/features/ui/components/columns_area.js
@@ -90,7 +90,11 @@ class ColumnsArea extends ImmutablePureComponent {
     }
 
     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 });
     }
 
@@ -125,7 +129,11 @@ class ColumnsArea extends ImmutablePureComponent {
     }
 
     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);
+      }
     }
   }