Use Events class for handling visibilitychange
This commit is contained in:
parent
29bd778757
commit
9543c47900
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue