How do I use other js files in a service worker? I don't know the right way to include my local js files into my service worker.
message handler in index.html
<script src="pushjs\push.min.js"></script>
<script src="pushjs\serviceWorker.min.js"></script>
messaging.onMessage(function (payload){
console.log("new message: " +payload);
//Push.create(payload.data.title);
console.log(payload.data.title);
console.log(payload.data.message);
var notifTitle = payload.data.title;
var notifMessage = payload.data.message;
console.log(notifTitle);
console.log(notifMessage);
Push.create(notifTitle, {
body: notifMessage,
});
});
background message handler in firebase-messaging-sw.js
messaging.setBackgroundMessageHandler(function(payload){
console.log(payload);
//Push.create(notifTitle, {
// body: notifMessage,
//});
// I would want to also use this here
})