1
0
mirror of https://github.com/RobinLinus/snapdrop.git synced 2025-05-15 23:20:11 -07:00

Use Events class for handling visibilitychange

This commit is contained in:
Haocen 2022-09-13 08:34:44 -04:00 committed by GitHub
parent 29bd778757
commit 9543c47900
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -438,10 +438,10 @@ class Notifications {
const visibilitychangeHandler = () => { const visibilitychangeHandler = () => {
if (document.visibilityState === 'visible') { if (document.visibilityState === 'visible') {
notification.close(); notification.close();
document.removeEventListener('visibilitychange', visibilitychangeHandler); Events.off('visibilitychange', visibilitychangeHandler);
} }
}; };
document.addEventListener('visibilitychange', visibilitychangeHandler); Events.on('visibilitychange', visibilitychangeHandler);
return notification; return notification;
} }