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

Unified Diff: polymer_1.0.4/bower_components/platinum-sw/platinum-sw-import-script.html

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/platinum-sw-import-script.html
diff --git a/polymer_1.0.4/bower_components/platinum-sw/platinum-sw-import-script.html b/polymer_1.0.4/bower_components/platinum-sw/platinum-sw-import-script.html
new file mode 100644
index 0000000000000000000000000000000000000000..2478f559bf67611d0d732c51adaaced8b739e79d
--- /dev/null
+++ b/polymer_1.0.4/bower_components/platinum-sw/platinum-sw-import-script.html
@@ -0,0 +1,57 @@
+<!--
+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
+-->
+<link rel="import" href="../polymer/polymer.html">
+
+<script>
+ /**
+ * The `<platinum-sw-import-script>` element is used to import a JavaScript file that is executed
+ * each time the service worker starts up.
+ *
+ * `<platinum-sw-import-script>` needs to be a child element of `<platinum-sw-register>`.
+ *
+ * A common use case is to define a custom request handler for a `fetch` event, but it can be used
+ * for any type of code that you want to be executed by the service worker.
+ *
+ * <platinum-sw-register>
+ * <platinum-sw-import-script href="custom-fetch-handler.js"></platinum-sw-import-script>
+ * <platinum-sw-fetch handler="customFetchHandler"
+ * path="/(.*)/customFetch"></platinum-sw-fetch>
+ * </platinum-sw-register>
+ *
+ * You can specify multiple `<platinum-sw-import-script>` elements, each one corresponding to a
+ * different JavaScript file. The JavaScript files will be loaded in the order in which the
+ * `<platinum-sw-import-script>` elements appear. Under the hood, this results in an
+ * [`importScripts()`](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/importScripts)
+ * call made from the context of the service worker.
+ */
+ Polymer({
+ is: 'platinum-sw-import-script',
+
+ properties: {
+ /**
+ * The URL of the JavaScript file that you want imported.
+ *
+ * Relative URLs are assumed to be
+ * relative to the service worker's script location, which will almost always be the same
+ * location as the page which includes this element.
+ */
+ href: String
+ },
+
+ _getParameters: function() {
+ return new Promise(function(resolve) {
+ var params = {};
+ if (this.href) {
+ params.importscript = this.href;
+ }
+ resolve(params);
+ }.bind(this));
+ }
+ });
+</script>

Powered by Google App Engine
This is Rietveld 408576698