Browse Source

check for both window and addEventListener

allows Uppy to work in React Native
Artur Paikin 6 years ago
parent
commit
3947f047f4
1 changed files with 1 additions and 1 deletions
  1. 1 1
      packages/@uppy/core/src/index.js

+ 1 - 1
packages/@uppy/core/src/index.js

@@ -785,7 +785,7 @@ class Uppy {
     })
 
     // show informer if offline
-    if (typeof document !== 'undefined') {
+    if (typeof window !== 'undefined' && window.addEventListener) {
       window.addEventListener('online', () => this.updateOnlineStatus())
       window.addEventListener('offline', () => this.updateOnlineStatus())
       setTimeout(() => this.updateOnlineStatus(), 3000)