1

How can I pass data from service worker to Angular 4 component? is it possible to use angular service to fix it? How to use navigator and PostMessage with angular 4? Please help me step by step:)

importScripts('https://www.gstatic.com/firebasejs/3.9.0/firebase-app.js');
importScripts('https://www.gstatic.com/firebasejs/3.9.0/firebase-messaging.js');

firebase.initializeApp({
  messagingSenderId: ""
});
const messaging = firebase.messaging();

postMessage({
      msg: "Hey I just got a fetch from you!",
      url: event.request.url
     });
Kek Testerov
  • 273
  • 2
  • 3
  • 8

1 Answers1

-2

I think you're trying to do too much before learning the basics :-)

I urge you to read Google's intro to SW and these guides.

pate
  • 4,937
  • 1
  • 19
  • 25