Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor( private SwPush : SwPush , private pushNotification : PushNotificationService ){
//check if the browser supports service workers
if( SwPush.isEnabled){
SwPush.requestSubscription({
serverPublicKey : VAPID_PUBLIC
})
.then( subscription => {
//send subsription to server
this.pushNotification.SendSubsriptionToService(subscription).subscribe() ;
})
.catch(console.error);
}
}
}