Im­por­tant tips

net magazine - - PROJECTS | PWAS -

Here are some key things to re­mem­ber when cre­at­ing your pro­gres­sive web app:

Use a HTTP S con­nec­tion Ser­vice Work­ers only work on HTTPS. Though lo­cal­host is white listed, please make sure that you serve your fi­nal code through a HTTPS con­nec­tion.

Add a kill switch Al­ways add a kill switch for your Ser­vice Worker. Caching, although a pow­er­ful tool, can go wrong. Please en­sure that you ap­pend a new ver­sion in your cache name when­ever you want the older one to be purged.

Avoid CDN s Make sure you serve your Ser­vice Worker file from the server in­stead of a CDN. This en­sures that you al­ways serve the fresh ver­sion of the file.

Use GET The Cache API spec­i­fi­ca­tion only al­lows GET re­sources to be cached. Re­sources fetched through other HTTP method will not be cached.

Keep your app shells light Only min­i­mal HTML, CSS and Java Script should go in your app shell – bloat­ing your ap­pli­ca­tion shell can cause de­lay in ren­der, which leads to a bad user ex­pe­ri­ence. Check Ser­vice Worker sup­port Ser­vice work­ers aren’t cur­rently sup­ported by all the browsers. Jake Archibald has cre­ated a nifty page to check the sta­tus of ser­vice work­ers on dif­fer­ent browsers: is ser­vice worker ready.

Newspapers in English

Newspapers from Australia

© PressReader. All rights reserved.