-
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
📖 Mention that amp-state can contain a constant #37479
Conversation
Add an example showing that it can be initialized to a constant, not just an object. (This is something I was never sure about when I first started using AMP.)
extensions/amp-bind/amp-bind.md
Outdated
<amp-state id="singleton"> | ||
<script type="application/json"> | ||
{ | ||
'I am a string' |
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.
This is not valid JSON, is that intended?
This would work afaik:
<script type="application/json">
'I am a string'
</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.
Good catch. I tested out something that looks exactly like what you did. Then, when I edited the docs, I added the useless curly brackets.
* Mention that amp-state can contain a constant Add an example showing that it can be initialized to a constant, not just an object. (This is something I was never sure about when I first started using AMP.) * Is prettify complaining because my line's >= 80 characters? * Trying still to make prettier happy. So embarrassing. * Remove spurious curly braces
* Mention that amp-state can contain a constant Add an example showing that it can be initialized to a constant, not just an object. (This is something I was never sure about when I first started using AMP.) * Is prettify complaining because my line's >= 80 characters? * Trying still to make prettier happy. So embarrassing. * Remove spurious curly braces
Add an example showing that it can be initialized to a constant, not just an object. (This is something I was never sure about when I first started using AMP.)
Note - I wasn't able to get the import to work on my local machine, so I tested this with an outdated version of the docs. It might be worth verifying this on a fully working build!