如何获取在 ServiceWorker 范围内注册 ServiceWorker 的页面的 URL?
main.js
console.log(window.location.pathname); // /user
navigator.serviceWorker.register('/app/sw.js',{scope : '/user'}).then(function(){
console.log('Service Worker initialised');
}).catch(function(er){
console.log('er.message);
});
sw.js
console.log(self.location.pathname); // /sw.js
// How can I get the `/user` URI?