当手机未打开应用程序(在后台)时,是否可以与服务工作者从本地存储中读取并跟踪PWA中的地理位置
到目前为止,我的研究表明没有,而且我发现PWA需要对位置服务开放。
谢谢,
我收到以下错误
ERROR Error: Uncaught (in promise): TypeError: Failed to register a ServiceWorker: A bad HTTP response code (404) was received when fetching the script.
TypeError: Failed to register a ServiceWorker: A bad HTTP response code (404) was received when fetching the script.
Run Code Online (Sandbox Code Playgroud)
我使用提示“ ng add @ angular / pwa”添加了ngsw-config.json和清单文件。该提示还将我的“ serviceWorker”:true语句和我在环境中的注册添加到了app.module.ts中。
确认所有内容均已正确添加后,我随后运行命令“ ng build --prod”,该命令成功构建,显示的dist已成为 dist文件夹
然后我运行“ ng serve --prod”,并且收到图像错误中显示的 错误
在app.module.ts中使用的行
ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production })
Run Code Online (Sandbox Code Playgroud)
ngsw-configuration:
{
"index": "/",
"assetGroups": [
{
"name": "app",
"installMode": "prefetch",
"resources": …Run Code Online (Sandbox Code Playgroud)