offline

Firestore - Using cache until online content updates

大城市里の小女人 提交于 2019-11-30 13:13:13
问题 I am starting with Firestore. I've read docs and tutorials about the offline data persistence but I have not really clear if Firestore downloads data again even if the content hasn't been modified. For example, if I have a query where the results will be updated once a week and I don't need that the app download the content again until the changes were made, what is the best way in terms of efficiency to write the code? Thanks! 回答1: You want to use the "snapshot listener" API to listen to

Offline / Online Data Synchronization Design (Javascript) [closed]

ⅰ亾dé卋堺 提交于 2019-11-30 10:19:22
问题 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 currently in the process of writing an offline webapp using all the html5 goodies for offline support. However I'm starting now to think about writing the sync module that will ensure that any offline data gets sent to the server and server data back to the client. Now I'm sure this has been done before, I

URL of page currently being served by Service Worker 'fetch' event

可紊 提交于 2019-11-30 09:31:01
问题 How can I get the full URL of the page which is being serviced by a service worker's 'fetch' event? The "self.location" property seems to only refer to the root URL of the site. For example, if page https://example.com/folder/pagename.html is performing a fetch which the service worker is intercepting, the service worker's 'self.location' property returns "https://example.com". event.currentTarget.location and event.explicitOriginalTarget.location, event.originalTarget, and event.target all

What is the use of `self.Clients.claim()`

旧街凉风 提交于 2019-11-30 08:50:11
To register a service worker, I can call navigator.serviceWorker.register('/worker.js') Every time the page loads it checks for an updated version of worker.js . If an update is found, the new worker won't be used until all the page's tabs are closed and then re-opened. The solution I read was: self.addEventListener('install', function(event) { event.waitUntil(self.skipWaiting()); }); self.addEventListener('activate', function(event) { event.waitUntil(self.clients.claim()); }); I can understand the skipWaiting part, but what exactly does clients.claim() do? I've done some simple tests and it

html5 offline caching with php driven sites

自闭症网瘾萝莉.ら 提交于 2019-11-30 08:32:11
问题 I have a simple php driven website running and I'm trying to figure out how it treats php pages. Some of my php documents are routing logic and some just includes for individual pages. How do i go about making this work offline? What I though was that I'd have to re-create the routing logic in javascript. Is that my only option? In that case, is it even possible to have the site be driven by php while online and switch to JS offline? I can't make sense of it. 回答1: If your site is fairly

Android voice recognition API offline

狂风中的少年 提交于 2019-11-30 08:29:16
Can someone please help me? I am developing an application with voice recognition via RecognizerIntent. Which Android version brought in officially the offline recognition available to apps by API? Is there any statement about it? By what I read until know it is not a choice of the developer if the voice recognition will be done via online service or the offline dictionaries. Am I right? Or are there any documented API to set offline? Thanks Now there is offline voice recognition is possible for android 4.1. check this article article and also check pochetsphinx 来源: https://stackoverflow.com

Offline language translation API [closed]

半城伤御伤魂 提交于 2019-11-30 07:08:48
问题 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 . Please note that I am aware that this question has appeared in various forms at several places, including stackoverflow, but I have yet to see a satisfying answer. There are several pretty solid language translation APIs out there (eg., Microsoft and Google). They are HTTP RESTful APIs that work well for web or

Firestore - Using cache until online content updates

别说谁变了你拦得住时间么 提交于 2019-11-30 06:49:25
I am starting with Firestore. I've read docs and tutorials about the offline data persistence but I have not really clear if Firestore downloads data again even if the content hasn't been modified. For example, if I have a query where the results will be updated once a week and I don't need that the app download the content again until the changes were made, what is the best way in terms of efficiency to write the code? Thanks! Sam Stern You want to use the "snapshot listener" API to listen to your query: https://firebase.google.com/docs/firestore/query-data/listen#listen_to_multiple_documents

Best practices for detecting offline state in a service worker

六眼飞鱼酱① 提交于 2019-11-30 06:47:16
问题 I have a service worker that is supposed to cache an offline.html page that is displayed if the client has no network connection. However, it sometimes believes the navigator is offline even when it is not. That is, navigator.onLine === false . This means the user may get offline.html instead of the actual content even when online, which is obviously something I'd like to avoid. This is how I register the service worker in my main.js : // Install service worker for offline use and caching if

Handling File Uploads When Offline With Service Worker

不羁岁月 提交于 2019-11-30 04:57:55
问题 We have a web app (built using AngularJS) that we're gradually adding PWA 'features' too (service worker, launchable, notifications, etc). One of the features our web app has is the ability to complete a web form while offline. At the moment, we store the data in IndexedDB when offline, and simply encourage the user to push that data to the server once they're online ("This form is saved to your device. Now you're back online, you should save it to the cloud..."). We will do this