question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use listenOnce in amp-story

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
juanlizarazocommented, 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

1reaction
newmuiscommented, Jul 11, 2018

Sure! Thanks @juanlizarazo!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Event bus implementation for clickable actions in amp story
click listeners in stories needs to be centrally managed. The navigation service needs an API similar to the anchor mutators but not restricted ......
Read more >
How do events and event objects work in amp-story? Is there ...
When an event occur in HTML, the event belongs to a certain event object, like a mouse click event belongs to the MouseEvent...
Read more >
Documentation: <amp-story-panning-media> - amp.dev
The amp-story-panning-media component provides a way to pan and zoom an image between pages in Web Stories. Usage. Use the amp-story-panning-media to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found