Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added percentageVisible{Max,Min} conditions for visibilitySpec. #2881

Merged
merged 1 commit into from
Apr 20, 2016

Conversation

avimehta
Copy link
Contributor

Part of #1297

Tests to follow.

// TODO(avimehta, #1297): Add all the listeners so that visibility
// conditions are monitored and callback is called when the conditions
// are met.
if (!config['visibilitySpec']) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind flipping the conditionals? !else double-negatives make everything confusing.

@avimehta
Copy link
Contributor Author

ptal. I am planning to add a few more tests but other stuff is ready for review.

let VisibilityListenerCallbackDef;

/**
* @typedef {Object.<string, JSONObject|VisibilityListenerCallbackDef>}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This always seems to be a VisibilityListenerDef.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The | is the confusing part then. Can you create a VisibilityListenerConfigDef?


this.registerForViewportEvents_();

this.listeners_[resId()] = (this.listeners_[resId()] || []);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This'll error, resId isn't a function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird. I swear I ran the tests. will fix.

@jridgewell
Copy link
Contributor

LGTM.

@avimehta avimehta merged commit 6a6bf4f into ampproject:master Apr 20, 2016
@avimehta avimehta deleted the ads2 branch April 20, 2016 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants