Server IP : 103.191.208.50 / Your IP : 216.73.216.53 Web Server : LiteSpeed System : Linux orion.herosite.pro 4.18.0-553.53.1.lve.el8.x86_64 #1 SMP Wed May 28 17:01:02 UTC 2025 x86_64 User : celkcksm ( 1031) PHP Version : 7.4.33 Disable Function : show_source, system, shell_exec, passthru, popen, exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/celkcksm/hrms.ncriptech.com/public/backend/js/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
const messaging = firebase.messaging(); const service_worker_url = $('#url').val()+'/hrm/firebase/sw-js'; // console.log(service_worker_url); navigator.serviceWorker.register(service_worker_url) .then((registration) => { messaging.useServiceWorker(registration); messaging.requestPermission() .then(function () { $('#__index_ltn').length > 0 && getRegToken(); }) .catch(function (err) { console.log('Unable to get permission to notify.', err); }); messaging.onMessage(function (payload) { notificationTitle = payload.data.title; notificationOptions = { body: payload.data.body, icon: payload.data.icon, image: payload.data.image, }; var notification = new Notification(notificationTitle, notificationOptions); }); }); function getRegToken(argument) { messaging.getToken().then(function (currentToken) { // console.log(currentToken); if (currentToken) { saveToken(currentToken); } else { } }) .catch(function (err) { // console.log('An error occurred while retrieving token. ', err); }); } function saveToken(currentToken) { $.ajax({ type: "POST", data: { _token: $('meta[name="csrf-token"]').attr("content"), firebase_token: currentToken, user_id : $('#fire_base_authenticate').val() }, url: $('meta[name="base-url"]').attr("content") + '/hrm/firebase-token/assign', success: function (data) { }, error: function (err) { } }); }