简体   繁体   English

我可以在没有 manifest.json 的情况下使用 Service Worker(仅用于 web 推送)吗?

[英]Can I use Service Worker (just for web push) in the absence of manifest.json?

All I need is my Service Worker to register as an event listener for the 'push' event.我只需要我的 Service Worker 注册为“推送”事件的事件侦听器。

However, when I look through multiple online courses on progressive web apps, they all include manifest.json at some point, which makes me question if including manifest.json is needed.但是,当我查看有关渐进式 web 应用程序的多个在线课程时,它们都包含 manifest.json,这让我怀疑是否需要包含 manifest.json。

I don't need Cache API or installable experience;我不需要缓存 API 或可安装经验; can I use Service Worker in my app to subscribe to the events I want?我可以在我的应用程序中使用 Service Worker 来订阅我想要的事件吗?

Why don't you just try it?你为什么不试试呢?

In any case yes, you can use Web Push with just a Service Worker.在任何情况下是的,您可以使用 Web Push 和一个 Service Worker。 You don't need the PWA manifest.您不需要 PWA 清单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM