Only start NoSleep after the first user interaction
This commit is contained in:
parent
a4564ad053
commit
4493dc35fe
@ -47,7 +47,7 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.initializePositionWatching();
|
||||
this.setNoSleep();
|
||||
this.listenForFirstInteraction();
|
||||
this.$store.dispatch('fetchReports');
|
||||
window.addEventListener('keydown', this.hideReportDialogOnEsc);
|
||||
},
|
||||
@ -162,6 +162,26 @@ export default {
|
||||
this.dialog = false;
|
||||
}
|
||||
},
|
||||
handleFirstUserInteraction() {
|
||||
this.setNoSleep();
|
||||
|
||||
window.removeEventListener('mousemove', this.handleFirstUserInteraction, false);
|
||||
window.removeEventListener('mousedown', this.handleFirstUserInteraction, false);
|
||||
window.removeEventListener('keypress', this.handleFirstUserInteraction, false);
|
||||
window.removeEventListener('DOMMouseScroll', this.handleFirstUserInteraction, false);
|
||||
window.removeEventListener('mousewheel', this.handleFirstUserInteraction, false);
|
||||
window.removeEventListener('touchmove', this.handleFirstUserInteraction, false);
|
||||
window.removeEventListener('MSPointerMove', this.handleFirstUserInteraction, false);
|
||||
},
|
||||
listenForFirstInteraction() {
|
||||
window.addEventListener('mousemove', this.handleFirstUserInteraction, false);
|
||||
window.addEventListener('mousedown', this.handleFirstUserInteraction, false);
|
||||
window.addEventListener('keypress', this.handleFirstUserInteraction, false);
|
||||
window.addEventListener('DOMMouseScroll', this.handleFirstUserInteraction, false);
|
||||
window.addEventListener('mousewheel', this.handleFirstUserInteraction, false);
|
||||
window.addEventListener('touchmove', this.handleFirstUserInteraction, false);
|
||||
window.addEventListener('MSPointerMove', this.handleFirstUserInteraction, false);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
@ -19,8 +19,6 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Vue from 'vue';
|
||||
|
||||
import { messages } from '@/i18n';
|
||||
import { storageAvailable } from '@/tools';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user