• Complain

Chris Love [Chris Love] - Progressive Web Application Development by Example

Here you can read online Chris Love [Chris Love] - Progressive Web Application Development by Example full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2018, publisher: Packt Publishing, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Chris Love [Chris Love] Progressive Web Application Development by Example
  • Book:
    Progressive Web Application Development by Example
  • Author:
  • Publisher:
    Packt Publishing
  • Genre:
  • Year:
    2018
  • Rating:
    4 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 80
    • 1
    • 2
    • 3
    • 4
    • 5

Progressive Web Application Development by Example: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Progressive Web Application Development by Example" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Leverage the full potential of the web to make your web sites better than native applications for every platform.

Key Features
  • Explore different models and patterns required to develop progressive web applications
  • Create applications requiring shorter runtime for attracting more users
  • Study different projects to understand the fundamentals of progressive web applications
Book Description

Are you a developer that wants to create truly cross-platform user experiences with a minimal footprint, free of store restrictions and features customers want? Then you need to get to grips with Progressive Web Applications (PWAs), a perfect amalgamation of web and mobile applications with a blazing-fast response time.

Progressive Web Application Development by Example helps you explore concepts of the PWA development by enabling you to develop three projects, starting with a 2048 game. In this game, you will review parts of a web manifest file and understand how a browser uses properties to define the home screen experience. You will then move on to learning how to develop and use a podcast client and be introduced to service workers. The application will demonstrate how service workers are registered and updated. In addition to this, you will review a caching API so that you have a firm understanding of how to use the cache within a service worker, and youll discover core caching strategies and how to code them within a service worker.

Finally, you will study how to build a tickets application, wherein youll apply advanced service worker techniques, such as cache invalidation. Also, youll learn about tools you can use to validate your applications and scaffold them for quality and consistency. By the end of the book, you will have walked through browser developer tools, node modules, and online tools for creating high-quality PWAs.

What you will learn
  • Explore the core principles of PWAs
  • Study the three main technical requirements of PWAs
  • Discover enhancing requirements to make PWAs transcend native apps and traditional websites
  • Create and install PWAs on common websites with a given HTTPS as the core requirement
  • Get acquainted with the service worker life cycle
  • Define service worker caching patterns
  • Apply caching strategies to three different website scenarios
  • Implement best practices for web performance
Who this book is for

Progressive Web Application Development by Example is for you if youre a web developer or front-end designer who wants to ensure improved user experiences. If you are an application developer with knowledge of HTML, CSS, and JavaScript, this book will help you enhance your skills in order to develop progressive web applications, the future of app development.

Downloading the example code for this book You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Chris Love [Chris Love]: author's other books


Who wrote Progressive Web Application Development by Example? Find out the surname, the name of the author of the book and a list of all author's works by series.

Progressive Web Application Development by Example — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Progressive Web Application Development by Example" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Summary

The service worker life cycle looks simple until you start working with service workers. Understanding how the life cycle executes is helpful so that you can understand what the state of your service worker is.

The service worker life cycle is designed to help us avoid situations where you upgrade and could potentially break the application. A new service worker can be registered, but wait for any existing clients to close. When safe, you could use the skipWaiting method to allow a new service worker to immediately take control.

More complex applications may also have multiple service workers with different scopes. This allows larger applications to silo control across the different sub applications.

Now that you have a foundation in how to use the service worker and the service worker life cycle, in the next chapter, you will see how to use the Fetch and Cache APIs to make the Podstr app work offline and save episodes to listen to anywhere, anytime.

Add and verify all domain protocol combinations in webmaster tools

The addition and verification of all domain protocol combinations in webmaster tools is another commonly overlooked migration task. If you are serious about search engine ranking, you will have your site properly registered with both Google and Bing's webmaster tools.

Details of both webmaster platforms is out of the scope of this book.

The best practice is to register all four ways in which your site might be referenced. You should register both HTTP and HTTPS versions for your primary domain and the www. alias. If you do not have all four registered, you will not have a fully registered site, and may suffer some search engine ranking issues.

Request object

The Request constructor has the same two parameters as the fetch method has, a URL and option initialization object. The following code modifies the fetch example to use a custom request object:

var myRequest = new Request("./api/podcast/" + id + ".json"); fetch(myRequest).then(function(response) { if (response.status !== 200) { console.log('Status Code: ' + response.status); return; } return response.json(); }).then(function(response) { console.log(data); });

You can do much more than just create a request object from a URL. You can craft a request using various options. While most requests are simple GET requests, there are many times where you need to craft something custom. The request object gives you the flexibility to make these requests.

The following example shows how to manage a potential redirect situation where you have changed your primary image folder:

self.addEventListener("fetch", function (event) { event.respondWith( var re = /img/S+/g; if(re.test(request.url)){ request = new Request(request.url.replace("img", "images"), { method: request.method, headers: request.headers, mode: request.mode, credentials: request.credentials }); } return fetch(request) .then(function (response) { //process response }) ); });

Of course, there are many other potential scenarios where you might need to modify a request before sending it to the network. Remember, if you make a custom request and cache the response, you will need to modify the request before checking the cache.

Installing workbox

Workbox is a collection of library and node modules. To get the full breadth of the tool, you need to install the node modules globally and clone the GitHub repository. Cloning the library is not required, but I recommend it so that you can study how the library is structured:

> npm install -g workbox-cli

The Workbox node modules include command-line interfaces to help you scaffold your service worker and Workbox components. I will cover how to use the CLI as I explain the different parts of the tool.

The first step you need to take after installing the CLI is to run the Workbox wizard:

> workbox wizard

This will start a series of questions about your application:

This will create a configuration file that the workbox-cli tool can use during - photo 1

This will create a configuration file that the workbox-cli tool can use during additional steps. This is what it generates when run and choosing the default options for the PWA ticket app:

module.exports = { "globDirectory": "C:\Source Code\PWA\pwa-ticket\www\public", "globPatterns": [ "**/*.{html,css,eot,svg,ttf,woff,woff2,png,txt,jpg,json,js,gif,manifest}" ], "swDest": "C:\Source Code\PWA\pwa-ticket\www\public\sw.js" };

The CLI commands use the settings in the configuration file to find all the files matching the globPatterns and creates an entry in the precache array. I will cover the precache list format in the next section:

I dont advise precaching 600 files and 11 MB like this example demonstrates - photo 2

I don't advise precaching 600 files and 11 MB like this example demonstrates. Instead, you should customize the configuration to trim the list to a proper amount. In this case, the PWA tickets app has all the ticket barcodes generated as part of the build process, so there is data to develop against.

I'll circle back around to show you how to customize the configuration file to maximize your Workbox service worker experience. The configuration file and the workbox-cli commands to compose your service worker are key to using the library.

You are free to use the Workbox library any way you see fit. The configuration is for the command-line tools. If you are not familiar with the different nuances to how Workbox works, then I suggest starting with the wizard first.

Once you have mastered or at least feel very comfortable with how the Workbox library works, you can start integrating it by hand. It all starts with importing the library to your service worker.

In previous chapters, I demonstrated how you can use importScripts to reference additional scripts within your service worker. You will need to reference the workbox library using importScripts:

self.importScripts("https://storage.googleapis.com/workbox-cdn/releases/3.2.0/workbox-sw.js", "js/libs/2ae25530a0dd28f30ca44f5182f0de61.min.js", "js/app/libs/e392a867bee507b90b366637460259aa.min.js", "sw/sw-push-manager.js" );

This example shows how I replaced some of the supporting libraries in the PWA tickets app with a reference to the CDN hosted Workbox script. The library is hosted in the Google Cloud CDN.

You can also use the workbox-cli copyLibrary command to copy the library to your site. The library is not a single file, but a collection of many files containing different JavaScript classes. These files are all copied to the target directory. I used the /sw folder in the PWA tickets app.

A folder with the current Workbox version number is created within the target folder. To add a reference to the library, you need to reference the workbox-sw.js file:

self.importScripts("sw/workbox-v3.2.0/workbox-sw.js", "js/libs/2ae25530a0dd28f30ca44f5182f0de61.min.js", "js/app/libs/e392a867bee507b90b366637460259aa.min.js", "sw/sw-push-manager.js" );

In previous Workbox versions, the entire library was loaded, which is a lot of code. This has been improved, so that now only the files needed by your service worker are loaded, reducing the payload and required storage. The 3.2 version I am using for this example has 23 different files or classes.

If you look in the folder that's created by the copyFiles method, you will see more. There are two versions for each class, production and debug. There are also source map files as well. I will show you how to toggle which versions are used as well as how to tell Workbox how to find the local modules a little later.

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Progressive Web Application Development by Example»

Look at similar books to Progressive Web Application Development by Example. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Progressive Web Application Development by Example»

Discussion, reviews of the book Progressive Web Application Development by Example and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.