}
componentWillMount () {
- if (typeof document.hidden !== 'undefined') { // Opera 12.10 and Firefox 18 and later support
- this.visibilityHiddenProp = 'hidden';
- this.visibilityChange = 'visibilitychange';
- } else if (typeof document.msHidden !== 'undefined') {
- this.visibilityHiddenProp = 'msHidden';
- this.visibilityChange = 'msvisibilitychange';
- } else if (typeof document.webkitHidden !== 'undefined') {
- this.visibilityHiddenProp = 'webkitHidden';
- this.visibilityChange = 'webkitvisibilitychange';
- }
- if (this.visibilityChange !== undefined) {
- document.addEventListener(this.visibilityChange, this.handleVisibilityChange, false);
- this.handleVisibilityChange();
- }
-
window.addEventListener('beforeunload', this.handleBeforeUnload, false);
document.addEventListener('dragenter', this.handleDragEnter, false);
document.addEventListener('dragover', this.handleDragOver, false);
this.hotkeys.__mousetrap__.stopCallback = (e, element) => {
return ['TEXTAREA', 'SELECT', 'INPUT'].includes(element.tagName) && !e.altKey;
};
+
+ if (typeof document.hidden !== 'undefined') { // Opera 12.10 and Firefox 18 and later support
+ this.visibilityHiddenProp = 'hidden';
+ this.visibilityChange = 'visibilitychange';
+ } else if (typeof document.msHidden !== 'undefined') {
+ this.visibilityHiddenProp = 'msHidden';
+ this.visibilityChange = 'msvisibilitychange';
+ } else if (typeof document.webkitHidden !== 'undefined') {
+ this.visibilityHiddenProp = 'webkitHidden';
+ this.visibilityChange = 'webkitvisibilitychange';
+ }
+
+ if (this.visibilityChange !== undefined) {
+ document.addEventListener(this.visibilityChange, this.handleVisibilityChange, false);
+ this.handleVisibilityChange();
+ }
}
componentDidUpdate (prevProps) {