fix: notification cause crash on android (#2938)
fix notification cause crash on android
This commit is contained in:
parent
0b99d85244
commit
909aa430b8
1 changed files with 9 additions and 1 deletions
|
|
@ -233,7 +233,15 @@ export const notificationPermission = (permission: NotificationPermission) => {
|
||||||
if ('Notification' in window) {
|
if ('Notification' in window) {
|
||||||
return window.Notification.permission === permission;
|
return window.Notification.permission === permission;
|
||||||
}
|
}
|
||||||
return false;
|
try {
|
||||||
|
// https://stackoverflow.com/questions/29774836/failed-to-construct-notification-illegal-constructor
|
||||||
|
// https://issues.chromium.org/issues/40415865
|
||||||
|
// eslint-disable-next-line no-new
|
||||||
|
new Notification('');
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getMouseEventCords = (event: MouseEvent) => ({
|
export const getMouseEventCords = (event: MouseEvent) => ({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue