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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!--
2 Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
3 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt
4 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
5 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt
6 Code distributed by Google as part of the polymer project is also
7 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt
8 -->
9 <link rel="import" href="../polymer/polymer.html">
10
11 <script>
12 /**
13 * The `<platinum-sw-import-script>` element is used to import a JavaScript fi le that is executed
14 * each time the service worker starts up.
15 *
16 * `<platinum-sw-import-script>` needs to be a child element of `<platinum-sw- register>`.
17 *
18 * A common use case is to define a custom request handler for a `fetch` event , but it can be used
19 * for any type of code that you want to be executed by the service worker.
20 *
21 * <platinum-sw-register>
22 * <platinum-sw-import-script href="custom-fetch-handler.js"></platinum- sw-import-script>
23 * <platinum-sw-fetch handler="customFetchHandler"
24 * path="/(.*)/customFetch"></platinum-sw-fetch>
25 * </platinum-sw-register>
26 *
27 * You can specify multiple `<platinum-sw-import-script>` elements, each one c orresponding to a
28 * different JavaScript file. The JavaScript files will be loaded in the order in which the
29 * `<platinum-sw-import-script>` elements appear. Under the hood, this results in an
30 * [`importScripts()`](https://developer.mozilla.org/en-US/docs/Web/API/Worker GlobalScope/importScripts)
31 * call made from the context of the service worker.
32 */
33 Polymer({
34 is: 'platinum-sw-import-script',
35
36 properties: {
37 /**
38 * The URL of the JavaScript file that you want imported.
39 *
40 * Relative URLs are assumed to be
41 * relative to the service worker's script location, which will almost alw ays be the same
42 * location as the page which includes this element.
43 */
44 href: String
45 },
46
47 _getParameters: function() {
48 return new Promise(function(resolve) {
49 var params = {};
50 if (this.href) {
51 params.importscript = this.href;
52 }
53 resolve(params);
54 }.bind(this));
55 }
56 });
57 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698