mirror of
https://github.com/janishutz/MusicPlayerV2.git
synced 2025-11-25 13:04:23 +00:00
some work on blur / visibility detection
This commit is contained in:
@@ -288,10 +288,30 @@ createApp( {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return flux;
|
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() {
|
mounted() {
|
||||||
this.connect();
|
this.connect();
|
||||||
|
this.notifier();
|
||||||
// if ( this.visualizationSettings === 'mic' ) {
|
// if ( this.visualizationSettings === 'mic' ) {
|
||||||
// this.micAudioHandler();
|
// this.micAudioHandler();
|
||||||
// }
|
// }
|
||||||
|
|||||||
Reference in New Issue
Block a user