Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Commit c7018f8

Browse files
committed
Merge pull request #20 from googlecodelabs/g3
Make js compiler happy
2 parents 46865a0 + 5b8eb36 commit c7018f8

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

analytics-behavior.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
-->
1616

1717
<script>
18+
19+
var GoogleCodelabs = window.GoogleCodelabs || {};
20+
1821
/**
1922
* `GoogleCodelabs.AnalyticsBehavior` implements Google Analytics functionality.
2023
*
2124
* @polymerBehavior GoogleCodelabs.AnalyticsBehavior
2225
*/
23-
24-
GoogleCodelabs = window.GoogleCodelabs || {};
25-
2626
GoogleCodelabs.AnalyticsBehavior = {
2727
listeners: {
2828
'google-codelab-step': '_trackStepChanged',
@@ -37,7 +37,7 @@
3737
params.hitType = hit;
3838
params.dimension1 = target.environment;
3939
params.dimension2 = target.category;
40-
window.ga(function() {
40+
window['ga'](function() {
4141
var trackers = ga.getAll();
4242
for (var i = 0; i < trackers.length; i++) {
4343
var tracker = trackers[i];

google-codelab-survey.html

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ <h4>How would rate your experience with Polymer?</h4>
8686
/**
8787
* Fired when user answers a survey question.
8888
* @event google-codelab-survey-answer
89-
* @detail {{question: String, answer: String}}
89+
* detail {{question: String, answer: String}}
9090
*/
9191

9292
properties: {
@@ -95,7 +95,10 @@ <h4>How would rate your experience with Polymer?</h4>
9595
* It is important to set this to a non-empty string
9696
* when hosting 2+ codelabs/surveys on the same domain.
9797
*/
98-
surveyId: '',
98+
surveyId: {
99+
type: String,
100+
value: ''
101+
},
99102

100103
/**
101104
* All answers, synced with `localStorage`.
@@ -131,7 +134,7 @@ <h4>How would rate your experience with Polymer?</h4>
131134
_storageLoaded: function() {
132135
var elems = this.getContentChildren();
133136
var answer = '';
134-
for (var i = 0; elem = elems[i]; i++) {
137+
for (var i = 0, elem; elem = elems[i]; i++) {
135138
if (elem.tagName === 'H4') {
136139
answer = this.answers[this._elemText(elem)];
137140
continue;
@@ -143,6 +146,10 @@ <h4>How would rate your experience with Polymer?</h4>
143146
}
144147
},
145148

149+
/**
150+
* @param {?} groupEl .
151+
* @param {?=} value .
152+
*/
146153
_selectAnswer: function(groupEl, value) {
147154
for (var i = 0, elem; elem = groupEl.children[i]; i++) {
148155
if (!elem.name) {

google-codelab.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ <h2>Would you like to resume where you left off?</h2>
177177
/**
178178
* Fired when user advances a codelab step or goes backwards.
179179
* @event google-codelab-step
180-
* @detail {{step: Object, index: Number}}
180+
* detail {{step: Object, index: Number}}
181181
*/
182182

183183
/**
@@ -350,7 +350,7 @@ <h2>Would you like to resume where you left off?</h2>
350350
ready: function() {
351351
// TODO: cannot be done on prototype.
352352
// SEe https://github.com/PolymerElements/iron-a11y-keys-behavior/issues/19
353-
this.keyEventTarget = document.body;
353+
this.keyEventTarget = /** @type {!HTMLBodyElement} */(document.body);
354354

355355
// select the step early, before localStorage is loaded
356356
this._updateStepIndexFromUrl();
@@ -410,7 +410,7 @@ <h2>Would you like to resume where you left off?</h2>
410410
var step = this.steps[this.selected];
411411
step.active = true;
412412

413-
location.hash = this.selected;
413+
location.hash = this.selected.toString();
414414

415415
this.fire('google-codelab-step', {index: this.selected, step: step});
416416

@@ -447,7 +447,7 @@ <h2>Would you like to resume where you left off?</h2>
447447
},
448448

449449
_updateStepIndexFromUrl: function() {
450-
var step = parseInt(location.hash.slice(1));
450+
var step = parseInt(location.hash.slice(1), 10);
451451
if (isNaN(step) || step < 0) {
452452
step = 0;
453453
}

0 commit comments

Comments
 (0)