some work on blur / visibility detection

This commit is contained in:
janis
2023-11-23 13:04:03 +01:00
parent 731e175b53
commit 3791dedb5b

View File

@@ -288,10 +288,30 @@ createApp( {
}
return flux;
},
notifier() {
console.log( 'notifier enabled' );
// Detect if window is currently in focus
window.onblur = () => {
console.log( 'left browser or page' );
}
// Detect key events
window.addEventListener( 'keypress', keyEvent => {
console.log( keyEvent.key );
} );
// Detect if browser window becomes hidden (also with blur event)
document.addEventListener( 'visibilitychange', visibilityEvent => {
if ( document.visibilityState === 'hidden' ) {
console.log( 'left page' );
}
} );
}
},
mounted() {
this.connect();
this.notifier();
// if ( this.visualizationSettings === 'mic' ) {
// this.micAudioHandler();
// }