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

Runtime: removing viewportCallback #30620

Closed
26 tasks done
samouri opened this issue Oct 12, 2020 · 1 comment
Closed
26 tasks done

Runtime: removing viewportCallback #30620

samouri opened this issue Oct 12, 2020 · 1 comment

Comments

@samouri
Copy link
Member

samouri commented Oct 12, 2020

summary
In an effort to shrink and simplify the V0 Runtime, we'd like to remove viewportCallback. There are three usages of it today:

  1. Maintaining a variable in base-element: inViewport_ and its associated getter isInViewport(). Only used by 5 components.
  2. Used by custom-element for loading indicator support.
  3. Miscellaneous by extensions:
    1. Video VISIBILITY events
      1. amp-3q-player
      2. amp-brightcove
      3. amp-dailymotion
      4. amp-ima-video
      5. amp-mowplayer
      6. amp-nexxtv-player
      7. amp-ooyala-player
      8. amp-powr-player
      9. amp-video
      10. amp-wistia-player
      11. amp-youtube
    2. Ads
      1. a4a, amp-ad-3p-iml: calls viewportCallback in xOriginIframeHandler. May still need to have handler within a4a instead of AmpAdXOriginIframeHandler.
      2. amp-ad-network-doubleclick-impl: subclass of a4a w/ extra handling.
    3. Other
      1. visibility event for 3d gltf.
      2. amp-anim: toggle placeholder to match whether in viewport. also hide if not in vp (style.toggle)
      3. amp-apester-media: toggling placeholder and marking if media has been seen / postMessaging to iframe if so.
      4. base-carousel 0.1: if in viewport, add control hints. also redirect to subclasses onViewportCallback :(
      5. amp-img-slider: similar to base-carousel. just if in viewport then show hints.
      6. amp-timeago 0.1: when enter viewport, reset timestamp
      7. amp-fx-flying-carpet: calls subresources viewportCallback. Indirection will still be necessary considering children are always in vp and need to only pay attn to this element for determining.
      8. unregister callbacks in videos and others
  4. Remove whenInViewport
  5. Remove isLayoutAllowed

Conditions of satisfaction

  • All traces of viewportCallback removed. A project search for either viewportCallback or this.isInViewport should both yield nothing.
  • Loading indicator mostly extracted from custom-element.
@samouri
Copy link
Member Author

samouri commented Oct 14, 2020

amp-fx-flying carpet actually can be removed for free after everything else is removed. It has no behavior besides delegating vpcb to children.

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

2 participants