Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- self.addEventListener('push', function(event) {
- //console.log('Received a push message', event);
- var title = 'Message title';
- var body = 'We have received a push message.';
- if (typeof(self.data) !== 'undefined') {
- if (typeof(self.data.message) !== 'undefined') {
- title = "My custom message!";
- body=self.data.message;
- }
- }
- var icon = '/img/icon-192x192.png';
- var tag = 'simple-push-demo-notification-tag';
- event.waitUntil(
- self.registration.showNotification(title, {
- body: body,
- icon: icon,
- tag: tag
- })
- );
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement