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

Use listenOnce in amp-story #13159

Closed
newmuis opened this issue Jan 30, 2018 · 6 comments
Closed

Use listenOnce in amp-story #13159

newmuis opened this issue Jan 30, 2018 · 6 comments

Comments

@newmuis
Copy link
Contributor

newmuis commented Jan 30, 2018

We have many places in amp-story code that add an event listener but do not remove it. For this, we can refactor to use listenOnce.

@ampprojectbot
Copy link
Member

This issue hasn't been updated in awhile. Do you have any updates?

@newmuis
Copy link
Contributor Author

newmuis commented Jun 5, 2018

This is a code cleanup that can happen during a fixit.

@juanlizarazo
Copy link
Member

I can work on this one

@newmuis
Copy link
Contributor Author

newmuis commented Jul 11, 2018

Sure! Thanks @juanlizarazo!

@juanlizarazo
Copy link
Member

juanlizarazo commented Jul 23, 2018

@newmuis I attempted to use listenOnce but that one removes the listener as soon as the event is received, it just executes each handler once for each event, e.g. next page would work just once.

So instead, I refactored this with listen and stored the unlisteners than then are called in unlayoutCallback.

PR #17004 is ready for review.

c.c. @mrjoro

@newmuis
Copy link
Contributor Author

newmuis commented Oct 2, 2018

After looking at @juanlizarazo's investigation, I think we actually don't want the behavior mentioned in the original report at all. Closing this issue.

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

No branches or pull requests

3 participants