service-worker

Can we run firebase realtime listening on ios serviceworker?

余生长醉 提交于 2019-12-28 12:47:03
问题 As of iOS 11.3 there is serviceworker feature supported Even though it has no support for notification. I wonder if it possible to just run any realtime listener, such as firebase database, to receive realtime data and use ServiceWorkerRegistration.showNotification to show local notification instead Is it possible? 回答1: While iOS don't support Web Push notifications yet(as of Apr-2018), all you can do is have an event listener for data from server side(Firebase in your case) and receive that

What can service workers do that web workers cannot?

时光怂恿深爱的人放手 提交于 2019-12-28 07:48:12
问题 What can service workers do that web workers cannot? Or vice versa? It seems that web workers are a subset of the functionality of service workers. Is this correct? 回答1: There is a big difference in what they are intended for: Web Workers Web Workers provide a simple means for web content to run scripts in background threads. The worker thread can perform tasks without interfering with the user interface. In addition, they can perform I/O using XMLHttpRequest (although the responseXML and

Call a function every minute from a service worker for an offline PWA [closed]

…衆ロ難τιáo~ 提交于 2019-12-25 18:05:36
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I'm working on a Progressive Web App (PWA) with offline support and I need to call a function in the app every minute from the service worker. (to send a web API based push notification if the user is offline) What is the best way to do this? 回答1: to call the function every minute use setInterval(): function

Call a function every minute from a service worker for an offline PWA [closed]

不问归期 提交于 2019-12-25 18:05:18
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I'm working on a Progressive Web App (PWA) with offline support and I need to call a function in the app every minute from the service worker. (to send a web API based push notification if the user is offline) What is the best way to do this? 回答1: to call the function every minute use setInterval(): function

webview.request access to requests initiated by the service worker

断了今生、忘了曾经 提交于 2019-12-25 01:40:51
问题 In a Chrome App I am able to access requests made by the <webview> and I am able to redirect if needed. The problem is the web app rendered inside the <webview> tag registers a service worker and lots of requests are handled by the service worker. Based on my tests the onBeforeRequest won't be notified. It works if I unregister the service worker, though. webview.request.onBeforeRequest.addListener( this.handleRequest, {urls: [pattern], types: ["image"]}, ["blocking"] ); So, is this a bug? or

Create React App shows serviceWorker.js and not the registerServiceWorker that a lot of tutorials show

爷,独闯天下 提交于 2019-12-25 01:15:36
问题 When I figured I would use Visual Studio Code to get a new React JS application started with learning it etc.. I ran across Microsoft site https://code.visualstudio.com/docs/nodejs/reactjs-tutorial In which this shows to import registerServiceWorker from './registerServiceWorker'; Meanwhile, there doesn't exist, when I create a new react app it has an index.js file with import * as serviceWorker from './serviceWorker'; // serviceWorker.unregister(); I don't like learning something that is

How to remove chrome icon add to home screen prompt

纵饮孤独 提交于 2019-12-24 23:53:31
问题 I am working with PWA app and I have an issue with add to home screen prompt. I need to remove the chrome badge from the app icon underneath. Here is my manifest.json { "short_name": "App Name", "name": "App Name", "icons": [ { "src": "...", "sizes": "192x192", "type": "image/png" }, { "src": "...", "sizes": "512x512", "type": "image/png" }, { "src": "...", "sizes": "64x64", "type": "image/png" } ], "start_url": "/login", "display": "standalone", "theme_color": "#ffc107", "background_color":

How can I wake up service worker when browser closed

我的梦境 提交于 2019-12-24 19:15:04
问题 I am playing with service worker stuff. I already made it as well as manifest json. I want to trigger service worker start after following scenario: Added push integration and sending push notification from server side. Received it in client side, but only if I am in my application page. Here are the steps what I want to try to start service worker: I opened the web page for the first time Service - Worker is installed I totally close the browser I re-open the browser Now I need to trigger

Service Worker Caches to much

偶尔善良 提交于 2019-12-24 19:14:46
问题 I'mm working on a service worker, who should just cache some specific files. But after implementation and refresh (yes I enabled "dumb sw after reload") there are much more files "loaded via the sw" then I added in the "files to cache" list. I'm new with the service worker and have no idea what is wrong. I just followed some tutorials about it. Here the code. Perhaps I am on the complete wrong way. if ('serviceWorker' in navigator) { window.addEventListener('load', function() { navigator

How To Add Service Worker In React Project

烈酒焚心 提交于 2019-12-24 17:09:30
问题 I want to add service worker in my react project. Project is ready the default Service seems not to works. Even When I try to import this, it gives this error: Attempted import error: './registerServiceWorker' does not contain a default export (imported as 'registerServiceWorker'). Furthermore, how to add files to be cached in the default version serviceWorker file. If I add my own custom serviceWorker file just like for no-react (framework) application, will it works for react case?