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

Refactor getElementPriority #3120

Merged
merged 2 commits into from
May 6, 2016

Conversation

muxin
Copy link
Contributor

@muxin muxin commented May 5, 2016

fixes #2714

@muxin muxin changed the title Refactor getElementPriority (#2714) Refactor getElementPriority May 5, 2016
@muxin muxin force-pushed the refactor-getElementPriority branch from 77098a8 to 83604fb Compare May 5, 2016 23:10
@@ -109,6 +109,7 @@ import {vsyncFor} from './vsync';
* Each method is called exactly once and overriding them in subclasses
* is optional.
*/

Copy link
Contributor

Choose a reason for hiding this comment

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

drop the line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -49,6 +49,11 @@ export function installAd(win) {

class AmpAd extends BaseElement {

/** @override */
getElementPriority() {
return 2;
Copy link
Member

@cramforce cramforce May 6, 2016

Choose a reason for hiding this comment

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

Please add something like
// loads ads after other content and analytics.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@cramforce cramforce assigned mkhatib and unassigned cramforce May 6, 2016
@cramforce
Copy link
Member

Excellent, thanks!

LGTM from me. Passing on to @mkhatib for final LGTM.

@@ -27,6 +27,11 @@ export class ElementStub extends BaseElement {
}

/** @override */
getPriority() {
throw new Error('Cannot get priority of stubbed element');
Copy link
Contributor

Choose a reason for hiding this comment

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

@dvoytenko is it ok to just through error like this here? No need to dev.assert it?

Copy link
Member

Choose a reason for hiding this comment

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

This is fine. Both do very similar things and both we want to show up in our production error reporting, because they are not expected to actually happen.

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool! Thanks

Copy link
Contributor

Choose a reason for hiding this comment

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

@cramforce not quite dev.assert is DCE'd so it won't be in prod errors reporting. But, I agree, let's leave new Error() here so that we actually do get the error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool

@mkhatib
Copy link
Contributor

mkhatib commented May 6, 2016

LGTM! Please rebase and wait for the tests to pass.

@mkhatib mkhatib added LGTM and removed NEEDS REVIEW labels May 6, 2016
@dvoytenko
Copy link
Contributor

LGTM

@muxin muxin force-pushed the refactor-getElementPriority branch from cb3aa3f to 9aa5f43 Compare May 6, 2016 22:04
@muxin muxin merged commit 8871f0b into ampproject:master May 6, 2016
@muxin muxin deleted the refactor-getElementPriority branch May 6, 2016 22:18
@mkhatib
Copy link
Contributor

mkhatib commented May 6, 2016

💃 💃 💃 💃 💃 💃

@jridgewell
Copy link
Contributor

First commit? 🎆 🎊 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor getElementPriority
5 participants