mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
icon add
This commit is contained in:
@@ -1,11 +1,29 @@
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register('./firebase-messaging-sw.js')
|
||||
.then(function(registration) {
|
||||
console.log('Registration successful, scope is:', registration.scope);
|
||||
}).catch(function(err) {
|
||||
console.log('Service worker registration failed, error:', err);
|
||||
});
|
||||
}
|
||||
if ("serviceWorker" in navigator) {
|
||||
navigator.serviceWorker
|
||||
.register("./firebase-messaging-sw.js")
|
||||
.then(function(registration) {
|
||||
console.log("Registration successful, scope is:", registration.scope);
|
||||
messaging.getToken({vapidKey: 'BEuyzkUKcx4FSs-6GaIz_si2oV5Ut7e5ZEtcrVvr5L_tMVWZtS1NTqdtQkih5QCt2FZKuRUxZIaLm5GaxI6nJEw', serviceWorkerRegistration : registration })
|
||||
.then((currentToken) => {
|
||||
if (currentToken) {
|
||||
console.log('current token for client: ', currentToken);
|
||||
|
||||
// Track the token -> client mapping, by sending to backend server
|
||||
// show on the UI that permission is secured
|
||||
} else {
|
||||
console.log('No registration token available. Request permission to generate one.');
|
||||
|
||||
// shows on the UI that permission is required
|
||||
}
|
||||
}).catch((err) => {
|
||||
console.log('An error occurred while retrieving token. ', err);
|
||||
// catch error while creating client token
|
||||
});
|
||||
})
|
||||
.catch(function(err) {
|
||||
console.log("Service worker registration failed, error:" , err );
|
||||
});
|
||||
}
|
||||
// Scripts for firebase and firebase messaging
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user