/* Bildirimler */ if ('serviceWorker' in navigator) { window.addEventListener('load', () => { navigator.serviceWorker.register('/service-worker.js') .then(reg => console.log('Service Worker registered!', reg)) .catch(err => console.log('Service Worker registration failed: ', err)); }); } document.getElementById('notifyButton').addEventListener('click', () => { if (Notification.permission === 'granted') { options = { dir : 'ltr', lang: 'tr', badge: '/Google-Logo-Monochrome.png', icon: '/Google-Logo-Monochrome.png', image: '/notifimg.jpg', body : 'Buradan başlayın', vibrate: [200, 100, 200, 100, 200, 100, 200], tag: 'bildirim', sound: '/bell.mp3', ttl: 86400, priority: 'high' } var notification = new Notification('Uygulamamıza hoşgeldiniz!', options ); notification.onclick = function () { window.open('/start'); }; } else if (Notification.permission !== 'denied') { Notification.requestPermission().then(permission => { if (permission === 'granted') { new Notification('Uygulamamıza hoşgeldiniz!'); } }); } }); function showNotification() { Notification.requestPermission().then((result) => { if (result === 'granted') { navigator.serviceWorker.ready.then((registration) => { registration.showNotification('Vibration Sample', { body: 'Buzz! Buzz!', dir : 'ltr', lang: 'tr', badge: '/Google-Logo-Monochrome.png', icon: '/Google-Logo-Monochrome.png', sound: '/bell.mp3', vibrate: [200, 100, 200, 100, 200, 100, 200], tag: 'bildirim', ttl: 86400, priority: 'high' }); }); } }); } function PushNotification() { Notification.requestPermission().then((result) => { if (result === 'granted') { navigator.serviceWorker.ready.then((registration) => { registration.showNotification('Notifications Sample', { title: 'Bildirim', body: 'Bildiriyorum!', badge: '/Google-Logo-Monochrome.png', icon: '/pazarax_logo.png', image: '/notifimg.jpg', vibrate: [200, 100, 200, 100, 200, 100, 200], timestamp: Date.now(), tag: 'ornek bildiri', data: { some_id: 77 } }); }); } }); }