Check for existence of Notification safely
This commit is contained in:
@@ -728,11 +728,13 @@ export default class ComfyApp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private requestPermissions() {
|
private requestPermissions() {
|
||||||
if (Notification.permission === "default") {
|
if (window.Notification != null) {
|
||||||
Notification.requestPermission()
|
if (window.Notification.permission === "default") {
|
||||||
|
window.Notification.requestPermission()
|
||||||
.then((result) => console.log("Notification status:", result));
|
.then((result) => console.log("Notification status:", result));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private setupColorScheme() {
|
private setupColorScheme() {
|
||||||
const setColor = (type: any, color: string) => {
|
const setColor = (type: any, color: string) => {
|
||||||
|
|||||||
@@ -92,6 +92,11 @@ function notifyToast(text: string, options: NotifyOptions) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function notifyNative(text: string, options: NotifyOptions) {
|
function notifyNative(text: string, options: NotifyOptions) {
|
||||||
|
if (window.Notification == null) {
|
||||||
|
console.warn("[notify] No Notification available on window")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (document.hasFocus())
|
if (document.hasFocus())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user