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

Unload resources in carousel #2123

Merged
merged 1 commit into from
Feb 19, 2016
Merged

Conversation

erwinmombay
Copy link
Member

closes #1293
closes #1334

@erwinmombay erwinmombay force-pushed the unload-video branch 3 times, most recently from d75a1fd to 7eda331 Compare February 18, 2016 20:40
@erwinmombay
Copy link
Member Author

@dvoytenko mind giving this a first, pass. super preliminary work. just want to make sure im in the right direction.

@erwinmombay erwinmombay force-pushed the unload-video branch 2 times, most recently from 3386f97 to ae9f721 Compare February 18, 2016 22:08
// when you null out an img tags src and you read it, it will be
// window.location.origin + window.location.path so we need
// to compare to the previously selected "src" above.
if (this.img_.src == '' || this.img_.src != src) {
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use img.getAttribute('src') instead.

img.src = '';
img.src; // => `${location.origin}${location.path}`
img.getAttribute('src'); // => ''

Copy link
Member Author

Choose a reason for hiding this comment

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

good fix, thanks!

@erwinmombay erwinmombay force-pushed the unload-video branch 3 times, most recently from 7ca7d81 to 33d0b69 Compare February 18, 2016 22:37
this.loadPromise_ = loadPromise(this.img_);
this.loadPromise_ = loadPromise(this.img_)
.catch(error => {
if (this.img_.getAttribute('src')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

You mean !this.img_.getAttribute('src'), right? If src was cleared, means that we expect the error.

Copy link
Member Author

Choose a reason for hiding this comment

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

yep, sorry just made the change hastily here and just havent pushed out latest changes with tests.
will mark done when ive pushed.

Copy link
Member Author

Choose a reason for hiding this comment

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

done.

@dvoytenko
Copy link
Contributor

Made few comments. Generally, it's very close. Please add tests.

@erwinmombay erwinmombay force-pushed the unload-video branch 3 times, most recently from 947fc82 to 12406a6 Compare February 19, 2016 06:13
@erwinmombay
Copy link
Member Author

@dvoytenko please review. should be finalized now.

i still need to add more tests, but everything on amp-carousel integration tests are failing for me locally currently...trying to figure that out.

@erwinmombay erwinmombay changed the title [WIP] Unload resources in carousel Unload resources in carousel Feb 19, 2016
@erwinmombay
Copy link
Member Author

@dvoytenko friendly ping. would like to wrap this up by EOB (yes eob!)


describe('integration amp-carousel', () => {

let fixture;
//let sandbox;
Copy link
Contributor

Choose a reason for hiding this comment

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

Comments. 😛

Copy link
Member Author

Choose a reason for hiding this comment

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

haha yeah, meant to leave it in intentionally. as my tests are all red locally for carousels. will remove and move it over to a different branch.

Copy link
Member Author

Choose a reason for hiding this comment

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

removed.

@dvoytenko
Copy link
Contributor

LGTM

erwinmombay added a commit that referenced this pull request Feb 19, 2016
@erwinmombay erwinmombay merged commit 1edbde4 into ampproject:master Feb 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants