-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Extract AMPPreactBaseElement #37309
Extract AMPPreactBaseElement #37309
Conversation
e9246ca
to
e3839e7
Compare
* @param {*} Y | ||
* @return {*} | ||
*/ | ||
export function setSuperClass(X, Y) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drive-by bikeshed (don't spend too much time here): I know @alanorozco and I disagree. But wanted to note here that I'm not a fan of the return X
line. The code ends up looking cleaner, but also gives the appearance of purity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally get what you mean - returning X does give the illusion that a new class is created, when in reality X's prototype is being modified (which will affect all instances of X whether they realize or not)
I could change
class AmpFoo extends setSuperClass(BaseElement, AmpPreactBaseElement) {...}
to
setSuperClass(BaseElement, AmpPreactBaseElement)
class AmpFoo extends BaseElement {...}
b2aeac3
to
ff7da91
Compare
Hey @westonruter, @ediamin! These files were changed:
|
b7c0b42
to
b1f0a49
Compare
Partial for #36950 |
4e125db
to
53aa9eb
Compare
Outstanding work to address #36950
Other outstanding quality of life refactors:
(addressed in separate PRs, tracked here) |
53aa9eb
to
c3d0c97
Compare
src/preact/amp-base-element.js
Outdated
import {PreactBaseElement} from './base-element'; | ||
|
||
export class AmpPreactBaseElement extends PreactBaseElement { | ||
// todo(kvchari): confirm this can be safely moved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flagging for presubmit visibility
* Displays loader. Override to customize. | ||
* @protected | ||
*/ | ||
handleOnLoad() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FMI: Do bento WCs not support loading/fallback/placeholder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding is that fallbacks and placeholders are an AMP concept and we're leaving the job of toggling an element on or off to consumers
@alanorozco can you confirm?
684b42b
to
1fc0c59
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
build system changes lgtm
@kvchari: anything holding up this PR? |
@kvchari: are you tracking the followup tasks anywhere? |
defineBentoElement()
can work effectively in tests (where tests are run in an iframe)VideoBaseElement
->AmpVideoBaseElement
since it's purely amp-relatedBaseElement
inamp-video
->BentoVideoBaseElement
to alignPartial #36950