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
Setting up code for AmpStoryEmbed viewer #26276
Conversation
@@ -144,13 +144,13 @@ exports.jsBundles = { | |||
includePolyfills: false, | |||
}, | |||
}, | |||
'amp-story-embed.js': { | |||
'amp-story-embed-manager.js': { |
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.
What's motivating the name change? This is still the JavaScript file for the <amp-story-embed>
component. This new name implies that it manages amp-story-embeds
, which it does not, except for the few lines of code at the end.
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.
Yeah, this change I think made sense in the context of #25006, but not here
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.
I thought we might want to keep it for when we introduce the AMP extension, to differentiate it and avoid renaming the import script?
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.
When publishers use this, do we want them to import
https://cdn.ampproject.org/v0/amp-story-embed-0.1.js
for the AMP version
and https://cdn.ampproject.org/v0/amp-story-embed-manager-0.1.js
for the pure-JS version?
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.
What I'm going to is.. if they are both called amp-story-embed.js
won't they override each other under https://cdn.ampproject.org/v0/
? or will they be in separate directories?
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.
Isn't you last bit of code using if (!isAMP)
meant to keep the same API so the same script works on both AMP and non AMP?
Even without this, the file name should reflect the name of the class it contains. And here, the class should really be AmpStoryEmbed
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.
Agreed with Gabriel here.
I think we should just drop the AMP/non-AMP split entirely and not implement this until we have an AMP version in hand.
What I'm going to is.. if they are both called amp-story-embed.js won't they override each other under https://cdn.ampproject.org/v0/? or will they be in separate directories?
They're different URLs. This is https://cdn.ampproject.org/amp-story-embed-v0.js, whereas the AMP extension would be https://cdn.ampproject.org/v0/amp-story-embed-0.1.js. At some point, if we have a binary that serves a version that can serve both AMP and non-AMP, we can alias these URLs to that binary
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.
Ah nice, thanks for clarifying
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.
PTAL
/to @jridgewell for OWNERS approval |
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.
Why isn't @ampproject/wg-stories an owner of src/amp-story-embed.js
?
Good question, I'll send a PR. Thanks all for the review :) |
Issue tracker #26308
Partial for #24539
Picking up work from #25006 by @newmuis
In preparation of having a pure JS library and an AMP extension of the viewer, this PR sets up the structure for managing the logic of both.
Given that our priority is the JS library for non-AMP pages, let's focus on this one first and then create the AMP extension which will use this new class.