Skip to content

Commit

Permalink
Fix compiler error from jsdoc annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
philipwalton committed Feb 22, 2017
1 parent 30dea88 commit 554d22a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
7 changes: 3 additions & 4 deletions autotrack.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion autotrack.js.map

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions lib/plugins/max-scroll-tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,16 @@ class MaxScrollTracker {
/**
* Detects changes to the tracker object and triggers an update if the page
* field has changed.
* @param {function(...*)} originalMethod A reference to the overridden
* method.
* @return {function(...*)}
* @param {function((Object|string), (string|undefined))} originalMethod
* A reference to the overridden method.
* @return {function((Object|string), (string|undefined))}
*/
trackerSetOverride(originalMethod) {
return (...args) => {
originalMethod(...args);
return (field, value) => {
originalMethod(field, value);

/** @type {!FieldsObj} */
const fields = isObject(args[0]) ? args[0] : {[args[0]]: args[1]};
const fields = isObject(field) ? field : {[field]: value};
if (fields.page) {
const lastPagePath = this.pagePath;
this.pagePath = this.getPagePath();
Expand Down
12 changes: 6 additions & 6 deletions lib/plugins/page-visibility-tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,20 +206,20 @@ class PageVisibilityTracker {
/**
* Detects changes to the tracker object and triggers an update if the page
* field has changed.
* @param {function(...*)} originalMethod A reference to the overridden
* method.
* @return {function(...*)}
* @param {function((Object|string), (string|undefined))} originalMethod
* A reference to the overridden method.
* @return {function((Object|string), (string|undefined))}
*/
trackerSetOverride(originalMethod) {
return (...args) => {
return (field, value) => {
/** @type {!FieldsObj} */
const fields = isObject(args[0]) ? args[0] : {[args[0]]: args[1]};
const fields = isObject(field) ? field : {[field]: value};
if (fields.page && fields.page !== this.tracker.get('page')) {
if (this.lastPageState == VISIBLE) {
this.handleChange();
}
}
originalMethod(...args);
originalMethod(field, value);
};
}

Expand Down

0 comments on commit 554d22a

Please sign in to comment.