Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(729)

Unified Diff: polymer_1.0.4/bower_components/platinum-sw/service-worker.js

Issue 1205703007: Add polymer 1.0 to npm_modules (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Renamed folder to 1.0.4 Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: polymer_1.0.4/bower_components/platinum-sw/service-worker.js
diff --git a/polymer_1.0.4/bower_components/platinum-sw/service-worker.js b/polymer_1.0.4/bower_components/platinum-sw/service-worker.js
new file mode 100644
index 0000000000000000000000000000000000000000..9766e608ccf31798437437a0cb03149592ff2e66
--- /dev/null
+++ b/polymer_1.0.4/bower_components/platinum-sw/service-worker.js
@@ -0,0 +1,52 @@
+/**
+ * @license
+ * Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
+ * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
+ * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
+ * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
+ * Code distributed by Google as part of the polymer project is also
+ * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
+ */
+
+var VERSION = '1.0';
+
+function deserializeUrlParams(queryString) {
+ return new Map(queryString.split('&').map(function(keyValuePair) {
+ var splits = keyValuePair.split('=');
+ var key = decodeURIComponent(splits[0]);
+ var value = decodeURIComponent(splits[1]);
+ if (value.indexOf(',') >= 0) {
+ value = value.split(',');
+ }
+
+ return [key, value];
+ }));
+}
+
+self.params = deserializeUrlParams(location.search.substring(1));
+
+if (params.get('version') !== VERSION) {
+ throw 'The registered script is version ' + VERSION +
+ ' and cannot be used with <platinum-sw-register> version ' + params.get('version');
+}
+
+if (params.has('importscript')) {
+ var scripts = params.get('importscript');
+ if (Array.isArray(scripts)) {
+ importScripts.apply(null, scripts);
+ } else {
+ importScripts(scripts);
+ }
+}
+
+if (params.get('skipWaiting') === 'true' && self.skipWaiting) {
+ self.addEventListener('install', function(e) {
+ e.waitUntil(self.skipWaiting());
+ });
+}
+
+if (params.get('clientsClaim') === 'true' && self.clients && self.clients.claim) {
+ self.addEventListener('activate', function(e) {
+ e.waitUntil(self.clients.claim());
+ });
+}

Powered by Google App Engine
This is Rietveld 408576698