Amphtml: Use listenOnce in amp-story

Created on 30 Jan 2018  路  6Comments  路  Source: ampproject/amphtml

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.

When Possible Bug stories

All 6 comments

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

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

I can work on this one

Sure! Thanks @juanlizarazo!

@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

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

edhollinghurst picture edhollinghurst  路  3Comments

choumx picture choumx  路  3Comments

torch2424 picture torch2424  路  3Comments

jpettitt picture jpettitt  路  3Comments

gmajoulet picture gmajoulet  路  3Comments