remove crash in Safari, #80
This commit is contained in:
@@ -216,9 +216,15 @@ class TinodeWeb extends React.Component {
|
|||||||
window.addEventListener('online', (e) => { this.handleOnline(true); });
|
window.addEventListener('online', (e) => { this.handleOnline(true); });
|
||||||
window.addEventListener('offline', (e) => { this.handleOnline(false); });
|
window.addEventListener('offline', (e) => { this.handleOnline(false); });
|
||||||
window.addEventListener('hashchange', this.handleHashRoute);
|
window.addEventListener('hashchange', this.handleHashRoute);
|
||||||
|
|
||||||
// Process background notifications from the service worker.
|
// Process background notifications from the service worker.
|
||||||
|
if (typeof BroadcastChannel == 'function') {
|
||||||
const serviceWorkerChannel = new BroadcastChannel('tinode-sw');
|
const serviceWorkerChannel = new BroadcastChannel('tinode-sw');
|
||||||
serviceWorkerChannel.addEventListener('message', this.handlePushMessage);
|
serviceWorkerChannel.addEventListener('message', this.handlePushMessage);
|
||||||
|
} else {
|
||||||
|
// Safari is broken by design.
|
||||||
|
console.warn('Your browser does not support BroadcastChannel. Some features will not be available');
|
||||||
|
}
|
||||||
|
|
||||||
// Window/tab visible or invisible for pausing timers.
|
// Window/tab visible or invisible for pausing timers.
|
||||||
document.addEventListener('visibilitychange', this.handleVisibilityEvent);
|
document.addEventListener('visibilitychange', this.handleVisibilityEvent);
|
||||||
|
|||||||
Reference in New Issue
Block a user