July 2018
Intermediate to advanced
354 pages
8h 51m
English
The 2048 and Podstr apps have relied on a single script. The PWA ticket app uses more complex techniques like importing libraries to drive the logic.
Service workers can load external scripts using the importScripts method. This function is available in the global scope and accepts an array of URLs. These are additional scripts and work much like the node.js require system:
self.importScripts("js/libs/localforage.min.js",
"js/app/libs/api.js",
"sw/response-mgr.js",
"sw/push-mgr.js",
"sw/invalidation-mgr.js",
"sw/date-mgr.js"
);
The first two scripts are also used in the client code. localForage is an IndexedDB wrapper and the API script manages access to the API and authentication token. The Mustache ...
Read now
Unlock full access