Default when there is no applicationServerKey meta on the page

This commit is contained in:
Morgan Bazalgette 2018-03-31 19:12:24 +02:00 committed by Haelwenn (lanodan) Monnier
parent fcaf59cea2
commit c43d48fdf1
No known key found for this signature in database
GPG key ID: D5B7A8E43C997DEE

View file

@ -14,7 +14,10 @@ const urlBase64ToUint8Array = (base64String) => {
return decodeBase64(base64);
};
const getApplicationServerKey = () => document.querySelector('[name="applicationServerKey"]').getAttribute('content');
const getApplicationServerKey = () => {
const k = document.querySelector('[name="applicationServerKey"]');
return k === null ? '' : k.getAttribute('content');
}
const getRegistration = () => navigator.serviceWorker.ready;