Warning: session_start(): open(/var/lib/php/sessions/sess_36173k3gtj899nuu695j7qkt93, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
sS hRegisterServiceWorker(S workerURL) {
ret hjs(replaceDollarVars(javaScript_hashLocalIdentifiers("serviceWorker_", [[
const #check = () => {
if (!('serviceWorker' in navigator)) {
throw new Error('No Service Worker support!')
}
if (!('PushManager' in window)) {
throw new Error('No Push API Support!')
}
};
const #requestNotificationPermission = async () => {
const permission = await window.Notification.requestPermission()
// value of permission can be 'granted', 'default', 'denied'
// granted: user has accepted the request
// default: user has dismissed the notification permission popup by clicking on x
// denied: user has denied the request.
if (permission !== 'granted') {
throw new Error('Permission not granted for Notification')
}
};
const #registerServiceWorker = async () => {
const swRegistration = await navigator.serviceWorker.register($workerURL, {scope: '/'});
return swRegistration;
};
const #showLocalNotification = (title, body, swRegistration) => {
swRegistration.showNotification(title, { body });
}
const #main = async () => {
check();
const swRegistration = await registerServiceWorker();
console.log("Service worker registered: " + swRegistration);
const permission = await requestNotificationPermission();
console.log("Notification permission: " + permission);
//showLocalNotification('Demo notification', 'Hello user', swRegistration);
};
main();
]]), +workerURL);
}