Don't show webpush section if navigator.serviceWorker is undefined
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
78ec74d253
commit
ea01b50b32
|
@ -686,7 +686,7 @@ export default class Notifications extends Vue {
|
||||||
}
|
}
|
||||||
|
|
||||||
async checkCanShowWebPush(): Promise<boolean> {
|
async checkCanShowWebPush(): Promise<boolean> {
|
||||||
if (!window.isSecureContext && !("serviceWorker" in navigator))
|
if (!window.isSecureContext || !("serviceWorker" in navigator))
|
||||||
return Promise.resolve(false);
|
return Promise.resolve(false);
|
||||||
const registration = await navigator.serviceWorker.getRegistration();
|
const registration = await navigator.serviceWorker.getRegistration();
|
||||||
return registration !== undefined;
|
return registration !== undefined;
|
||||||
|
|
Loading…
Reference in a new issue