聚合物服务和维修人员 [英] Polymer serve and service worker

查看:101
本文介绍了聚合物服务和维修人员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试调试Polymer应用程序.我是通过复制PolymerCLI Polymer init所做的事情来手工制作的.

I am trying to get started on debugging my Polymer application. I have hand crafted it by copying what I think the PolymerCLI Polymer init does.

我不确定正在加载服务工作者.用于开发的默认程序只是执行console.info()调用,说它已被禁用用于开发.

I am not sure what is loading service worker. The default one for development just does a console.info() call saying its been disabled for development.

当我使用Polymer serve在本地主机上服务我的应用程序:8080时,尽管没有地方实际加载文件service-worker.js,我仍收到console.info消息.因为应用程序要复杂得多(并且我正在尝试使用http/2),所以我也有自己的基于节点的服务器.当我运行该文件然后在浏览器中获取我的应用程序时,service-worker.js不会加载并运行.

When I use Polymer serve to serve my application on localhost: 8080, I get the console.info message, despite there being nowhere where I actually load the file service-worker.js . Because the application is much more complex (and I am trying to use http/2) I have my own node based server as well. When I run that and then fetch my application in the browser, service-worker.js does not get loaded and run.

Polymer serve如何启用它?

推荐答案

可能是使用相同源(例如localhost:8080)的其他应用程序注册并安装了服务工作者.

It could be that a different application which used the same source (e.g. localhost:8080) registered and installed a service worker.

在Chrome Canary中打开应用程序"面板以检查/删除服务工作者.

Open up the Application panel in Chrome Canary to inspect / delete the service worker.

如果您无法访问Chrome Canary,请打开chrome://serviceworker-internals,找到与您的应用匹配的范围,然后点击取消注册. serviceworker-internals顶部还有一个选项,可让您打开DevTools窗口并在SW上暂停JS.启用该选项,您将能够看到正在运行的软件.

If you can't access Chrome Canary, open chrome://serviceworker-internals, find the scope that matches your app, and click Unregister. There's also an option at the top of serviceworker-internals which lets you open a DevTools window and pause JS on the SW. Enable that option and you'll be able to see which SW is running.

这篇关于聚合物服务和维修人员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆