UNPKG

2.83 kBJavaScriptView Raw
1"use strict";
2
3/*
4 Copyright 2017 Google Inc.
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10 https://www.apache.org/licenses/LICENSE-2.0
11
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17*/
18
19module.exports = `/**
20 * Welcome to your Workbox-powered service worker!
21 *
22 * You'll need to register this file in your web app and you should
23 * disable HTTP caching for this file too.
24 * See https://goo.gl/nhQhGp
25 *
26 * The rest of the code is auto-generated. Please don't update this file
27 * directly; instead, make changes to your Workbox build configuration
28 * and re-run your build process.
29 * See https://goo.gl/2aRDsh
30 */
31
32<% if (workboxSWImport) { %>
33importScripts(<%= JSON.stringify(workboxSWImport) %>);
34<% if (modulePathPrefix) { %>workbox.setConfig({modulePathPrefix: <%= JSON.stringify(modulePathPrefix) %>});<% } %>
35<% } %>
36<% if (importScripts) { %>
37importScripts(
38 <%= importScripts.map(JSON.stringify).join(',\\n ') %>
39);
40<% } %>
41
42<% if (cacheId) { %>workbox.core.setCacheNameDetails({prefix: <%= JSON.stringify(cacheId) %>});<% } %>
43
44<% if (skipWaiting) { %>workbox.skipWaiting();<% } %>
45<% if (clientsClaim) { %>workbox.clientsClaim();<% } %>
46
47<% if (Array.isArray(manifestEntries)) {%>
48/**
49 * The workboxSW.precacheAndRoute() method efficiently caches and responds to
50 * requests for URLs in the manifest.
51 * See https://goo.gl/S9QRab
52 */
53self.__precacheManifest = <%= JSON.stringify(manifestEntries, null, 2) %>.concat(self.__precacheManifest || []);
54workbox.precaching.suppressWarnings();
55workbox.precaching.precacheAndRoute(self.__precacheManifest, <%= precacheOptionsString %>);
56<% } else { %>
57if (Array.isArray(self.__precacheManifest)) {
58 workbox.precaching.suppressWarnings();
59 workbox.precaching.precacheAndRoute(self.__precacheManifest, <%= precacheOptionsString %>);
60}
61<% } %>
62<% if (navigateFallback) { %>workbox.routing.registerNavigationRoute(<%= JSON.stringify(navigateFallback) %><% if (navigateFallbackWhitelist || navigateFallbackBlacklist) { %>, {
63 <% if (navigateFallbackWhitelist) { %>whitelist: [<%= navigateFallbackWhitelist %>],<% } %>
64 <% if (navigateFallbackBlacklist) { %>blacklist: [<%= navigateFallbackBlacklist %>],<% } %>
65}<% } %>);<% } %>
66
67<% if (runtimeCaching) { runtimeCaching.forEach(runtimeCachingString => {%><%= runtimeCachingString %><% });} %>
68
69<% if (offlineAnalyticsConfigString) { %>workbox.googleAnalytics.initialize(<%= offlineAnalyticsConfigString %>);<% } %>`;
\No newline at end of file