service-worker

Synchronous or Sequential fetch in Service Worker [duplicate]

纵然是瞬间 提交于 2019-12-23 12:03:30
问题 This question already has answers here : Resolve promises one after another (i.e. in sequence)? (24 answers) Closed 4 years ago . I need to send a series of PUT & POST requests from a Service Worker. The order in which they're sent matters. Requirements: Given a request method, url, and JSON body, send the request If it succeeds ( response.status < 300 ): Pass body to a success function Call next request in queue If it fails: Pass responseText or err to error function Stop execution If I

Communcation between service worker and web page

天大地大妈咪最大 提交于 2019-12-23 10:44:20
问题 I'm working on an application where the goal is sending the user a notification at a regular interval (every hour for example). My idea was to use a service worker that could be running once the tab has been closed and keep on sending the user these notifications. The web page needs to be able to communicate with the service worker about specific details about these notifications, what the message should be, at what interval it should be running and such. I'm having trouble understanding how

Communcation between service worker and web page

帅比萌擦擦* 提交于 2019-12-23 10:44:06
问题 I'm working on an application where the goal is sending the user a notification at a regular interval (every hour for example). My idea was to use a service worker that could be running once the tab has been closed and keep on sending the user these notifications. The web page needs to be able to communicate with the service worker about specific details about these notifications, what the message should be, at what interval it should be running and such. I'm having trouble understanding how

Why can't serviceworker access cookies

拜拜、爱过 提交于 2019-12-23 09:34:40
问题 As per as i know Service Workers can not access the cookies. Because of this i am facing a lot of problems in implementing SW for my site. I want to know what are the reasons, that Service Workers can not access the cookies.Right now I am using messaging to convey the cookie content to Service Workers . Is there any better way or hack to do it more efficiently? 回答1: There is no reason. Some use cases have been proposed and a new API is under development. Sure your use case and insights are

How to stop older service workers?

孤人 提交于 2019-12-23 09:18:29
问题 The image below shows that there are two workers installed - one active and the other not active (just installed). Register a service worker Make changes to service-worker.js and reload the page. The logic is that Service Workers check binary diff and updates the versions of the workers. So a new service worker is spawned with a new version ID. But why does the old one keeps running ? and How do I close it ? The sw.js is here https://gist.github.com/boopathi/57b7e8b6d657d55bdc7d 回答1: By

Service Worker TypeError when opening Chrome extension

。_饼干妹妹 提交于 2019-12-23 09:11:31
问题 My service worker is throwing this error in Chrome when I open the WAVE (Web Accessibility Evaluation Tool) extension: Uncaught (in promise) TypeError: Request scheme 'chrome-extension' is unsupported at sw.js:52 (anonymous) @ sw.js:52 Promise.then (async) (anonymous) @ sw.js:50 Promise.then (async) (anonymous) @ sw.js:45 Promise.then (async) (anonymous) @ sw.js:38 My service worker code is: (function () { 'use strict'; var consoleLog; var writeToConsole; const CACHE_NAME = '20180307110051';

Service Worker: handle requests when offline to send them when online

ぐ巨炮叔叔 提交于 2019-12-23 04:56:31
问题 I have a chat web application and I want it to work offline. For this I use progressive web apps features (Service Workers) to use cache to get the shell app and the messages already loaded. What I want to do is to be able to make a post message when I'm offline and let the service worker handle the connection issues (i.e.: keep the message somewhere till where are offline and as soon as we are online send the Post message). I want to use Service Worker because I also want to send the message

Angular 6 : DevTools failed to parse SourceMap: https://example.com/ngsw_worker.es6.js.map

谁说胖子不能爱 提交于 2019-12-23 03:47:05
问题 I converted my angular 6 application to PWA using the Angular CLI (ng add @angular/pwa). I only have one project in my directory and so I ran this command without specifying project name. After deployment, the service worker registers - and everything seems to be in order expect i get the following error in google chrome console: DevTools failed to parse SourceMap: https://example.com/ngsw_worker.es6.js.map What does this error mean? And how can it be fixed/avoided? Thank you! 回答1: Go to

Can't see service worker logs

守給你的承諾、 提交于 2019-12-23 03:25:23
问题 Can't see logs of my service worker. Here are steps I tried to open logs for registered and running service worker. Open chrome://serviceworker-internals/ Click Start and Inspect Refresh inspect window Wait for logs to appear But, both chrome://serviceworker-internals/ and ServiceWorker inspection shows zero logs. However, source tab on inspect page shows latest code, which should print console.log Here is the source code I am trying to see the logs of messaging.setBackgroundMessageHandler

Can't subscribe to Push notification

雨燕双飞 提交于 2019-12-23 03:22:19
问题 I'm trying to subscribe to PushManager to send push notification, but I'm always getting an error when calling subscribe. This is my subscribe call registration.pushManager.subscribe({ userVisibleOnly: true }) .then(function (subscription) { /* ... */}) .catch(function (err) { /* ... */}) Nothing weird as you can see, and that call is always throwing DOMException: Registration failed - push service error I'm not sure why is that. What I've checked so far I have a gcm_sender_id property in my