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

Side by Side Diff: polymer_1.0.4/bower_components/google-analytics/google-analytics-loader.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 <link rel="import" href="../polymer/polymer.html">
2 <link rel="import" href="../google-signin/google-signin-aware.html">
3 <link rel="import" href="../google-apis/google-client-loader.html">
4 <link rel="import" href="../promise-polyfill/promise-polyfill-lite.html">
5
6 <!--
7 google-analytics-loader is used internally by elements that need to know api sta te, and user state.
8
9 Loads gapi.client.analytics, and watches user signed-in state.
10
11 @element google-analytics-loader
12 @homepage https://googlewebcomponents.github.io/google-analytics
13 -->
14 <dom-module id="google-analytics-loader">
15 <template>
16 <google-client-loader id="api"
17 name="analytics"
18 version="v3"
19 on-google-api-load="handleApiLoad"
20 on-google-api-load-error="handleApiFailedToLoad"></google-client-loader>
21 <google-signin-aware
22 scopes="https://www.googleapis.com/auth/analytics.readonly"
23 on-google-signin-aware-success="handleAuthSuccess"
24 on-google-signin-aware-signed-out="handleAuthSignout"></google-signin-awar e>
25 </template>
26 </dom-module>
27
28 <script>
29 (function() {
30
31 'use strict';
32
33 Polymer({
34
35 is: 'google-analytics-loader',
36
37 properties: {
38 /**
39 * True when user is authorized, and api is loaded
40 * @attribute allReady
41 * @type {Boolean}
42 */
43 allReady: {
44 type: Boolean,
45 computed: 'computeAllReady(apiReady, authorized)',
46 notify: true
47 },
48 /**
49 * True when api is loaded
50 * @attribute apiReady
51 * @type {Boolean}
52 */
53 apiReady: {
54 type: Boolean,
55 value: false,
56 notify: true,
57 readOnly: true
58 },
59 /**
60 * True when user is authorized
61 * @attribute authorized
62 * @type {Boolean}
63 */
64 authorized: {
65 type: Boolean,
66 value: false,
67 notify: true,
68 readOnly: true
69 }
70 },
71
72 computeAllReady: function(apiReady, authorized) {
73 return apiReady && authorized;
74 },
75
76 handleApiLoad: function() {
77 this._setApiReady(true);
78 },
79
80 handleApiFailedToLoad: function(ev, detail) {
81 this._setApiReady(false);
82 console.error("Api failed to load: ", this.$.api.name, this.$.api.versio n);
83 },
84
85 handleAuthSuccess: function() {
86 this._setAuthorized(true);
87 },
88
89 handleAuthSignout: function() {
90 this._setAuthorized(false);
91 }
92 });
93
94 })();
95
96 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698