cache the next time it is requested.
Serviceworker Caching process
The fetch event code in the Serviceworker file is as follows:
Self.addeventlistener (' Fetch ',function(event) {Event.respondwith (Caches.match (event.request). Then (function(response) {if(response) {returnresponse; }
varRequesttocache =Event.request.clone (); returnFetch (Requesttocache). Then (function(response) {if(!response | | response.status!== 200){
returnresponse; }
v
"title=" image "style=" border-right-width:0px;background-image:none; border-bottom-width:0px;padding-top:0px;padding-left:0px;margin:0px;padding-right:0px;border-top-width:0px; " alt= "image" Src= "http://s3.51cto.com/wyfs02/M02/8F/1E/wKioL1jUbCChwNnWAAEkZEIIz2U451.png" border= "0"/>Then we are surprised to find that the lock state is .... Not locked!!! Continue flying blind!!!650) this.width=650; "alt=" Picture "src=" https://fud.community.services.support.microsoft.com/Fud/ Filedownloadhandl
PWA (Progressive Web application) + SPA (but also applied) a simple thought
Preface
It was not the professional adjective of PWA (progressive Web application) that was previously heard. At that time has actually learned that Google to do a thing, before the city so described: do not need an operating system, software directly running on the hardware. Surprised,
The first blog in 2018, has recently been to squeeze the library, I hope the New Year ...Brief introductionPWA is a new web front-end technology launched by Google, the full name of Progressive Web App, which Google introduced in 2015 and launched in June 2016, is a combination of a series of modern web technologies, Implement a user experience that is similar to native apps in Web applications.PWA does not
ObjectiveIn the previous chapter, a basic introduction to the related concepts of PWA was made, and the composition and advantages of PWA were understood. In order to get into the world of PWA faster, this chapter focuses on the issues that need attention in PWA development, the environment in which they are run, and t
In the previous article we made some basic introductions to progressive Web applications (PWA).Progressive web App (PWA) Getting Started tutorial (top)In this section, we'll show you what the principle of PWA is and how it began to work.First step: Use HTTPSAn incremental Web application requires an HTTPS connection. While using HTTPS can make your server more ex
Most of the kids who are doing project management and configuration management are familiar with project use. They also checked a lot of information when they first came into contact with PWA, however, I found that there are very few posts that have detailed descriptions of the Project Server. Due to the needs of the Department, I tried my best to study it for a few days. I hope you can use it.
1. Set the user
2. Connect the local project to the Proje
I've done a lot of testing on Project Server 2013 before, and it hasn't been sent up. Now finally thinking can write some of their own things, are relatively simple, I am also a novice.Previously tested documents I will be sent up, for the new reference, do not understand, we can also discuss together.I'm not going to write a document about the installation operation, I'll do it again if I need it later. For the next few articles, I wrote the one after project
Some people ask me why the Project Server 2013 they installed lacks many things, like SharePoint 2013, especially when assigning permissions to users. Next I will share with you how to solve this problem.1. Two Security modes of PWA
Projectserver 2013 provides two security modes to control access permissions to websites and projects:
SharePointPermission ModeIn this mode (New in Project Server 2013), a special SharePoint Security Group is created o
Most of the analysis results show that some tasks of the project have unreasonable logic in allocation and work hours, leading to exceptions in the webpart. Usually, the PWA System maintenance staff will be crazy at this time, because no one changes the settings, the server services are normal, and this logical error occurs inadvertently under the project manager. I felt that the last second was still good, and suddenly I got down. (For administrators
Even if you had your application fully cached, you couldn ' t perform any external request without internet connection. That's why in order to build a offline-capable application, you must know when it ' s actually offline.This lesson shows the Navigatoronline API and Online/offline events on order to disable the functionality T o Send messages of the application. this. Online = navigator.online window.addeventlistener (' online ', () + = (This True) window.addeventlistener (' Offline
Previously we saw how to hijacking all the reqest, but this is not useful. So-now we want to see how to hijacking one kind of request. For example we want SERVCE worker only response to the request ends with ". jpg":Self.addeventlistener ('Fetch', Function (Event) { //Todo:only respond to requests with a//url ending in ". jpg" if(Event. Request.url.endsWith (". jpg")){ Event. Respondwith (Fetch ('/imgs/dr-evil.gif') ); }});Https://developer.mozilla.org/en-US/docs/Web/API/Request[
', ' dismiss '] }); Toast.answer.then (function(answer) { if (answer! = ' Refresh ') { // Tell the service worker to skipwaiting Worker.postmessage ({message: ' Skipwaiting '}} );};Service worker: Listen to the message event and call Skilwaiting ():// Todo:listen for the ' message ' event, and call // skipwaiting If you get the appropriate message function (event) { if(event.data.message = = "Skipwaiting") { self.skipwaiting (); }})The on We page, listen to Control
Once serive worker is registered, the first time we go to the app, we cannot see the logs from servcie works. Any only refersh it second time, then we able to see the logs.
Once we change service worker, it doesn't seem that we have change it.
The no1. is because, service worker only take control after it is loaded. but the first time we go to the page, service worker actually is not there, because, the browser need to fetch our assets, CSS, and JavaScript f
Pwa:add to Home screen
Angular Universal Server side rendering:for achieving better proference on init loading
Angular 2 CLI
ng New MyApp--mobile
Sw-precache:with Webpack:
Sw-toolbox:run Time Caching
ANGULAR2 Material Design:
*shellrender and *shellnorender
*shellrender:work as App Shell, happen before Angular 2 Component get rendered*shellnorender:angular2 Component take placeGO PROGRESSIVE[PWA
store one copy of each avatar. varStorageurl = Request.url.replace (/-\dx\.jpg$/, "); //Todo:return images from the "Wittr-content-imgs" cache //if they ' re in there. But afterwards, go to the network //To update the entry in the cache. // //Note that this is slightly different to servephoto! returnCaches.open (Contentimgscache). Then (function(cache) {returnCache.match (Storageurl). Then (function(response) {varNetfetchresponse = Fetch (Request). Then (function(networkresponse) {cache.p
Intead of Cache The root floder, we want to cache skeleton instead. self.addeventlistener (' Install ', function function return
Cache.addall ([
'/ ' js/main.js ' ' css/main.css ' , ' imgs/icon.png ' , ' https://fonts.gstatic.com/s /roboto/v15/2ux7wltfw3w8tcltuvlfyq.woff ' , ' https://fonts.gstatic.com/s /roboto/v15/d-6iyplofoccackzxwxsod8e0i7kzn-epnyo3hzu7kw.woff ' Respond to requests for the root page with thepage skeleton from the cache:Self.addeventlisten
' }); Store.createindex (' by-date ', ' time '); });In _opensocket, we had a function to fetch the old data from the IDB.// Open a connection to the server for live updates function () {... Ws.addeventlistener (function(event) { requestanimationframe() { Indexcontroller. _onsocketmessage (event.data); }); ...};//called when the Web socket sends message dataIndexcontroller.prototype._onsocketmessage =function(data) {varMessages =json.parse (data); This. _dbpromise.then (func
all the messages, //gather all the photo URLs. // //Open the ' Wittr-content-imgs ' cache, and delete any entry //That you no longer need. varPhotostokeep = []; vartx = Db.transaction (' Wittrs '); returnTx.objectstore (' Wittrs '). GetAll (). Then (function(Messages) {Messages.foreach (function(message) {if(Message.photo) {Photostokeep.push (Message.photo); } }); returnCaches.open (' Wittr-content-imgs '); }). Then (function(cach
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.