We would like to write some code to check whether the site is already opened and focused before showing a push notification, so we can display the information directly in the page by some other means. Otherwise, there is an awkward user experience where clicking on the notification opens another tab and loads the page a second time. For reference, this is a Common Notification Pattern in Google Developer Web Fundamentals. (https://developers.google.com/web/fundamentals/push-notifications/common-notification-patterns)
To do this, we would need to modify or extend the service worker with some custom code. I suppose we could try to modify the (somewhat) minified contents of https://aswpsdkus.com/notify/v1/ua-sdk.min.js and insert that directly into push-worker.js, but that seems like a brittle solution that would likely be broken any time the sdk is updated. Do you offer a un-minified version of the push worker code, or any supported method to extend it?
Thanks for your time!
Comments
1 comment