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

amp-bind: Add "global" reference #23796

Merged
merged 2 commits into from
Aug 7, 2019

Conversation

dreamofabear
Copy link

Fixes #20167.

Useful for referencing amp-state with non-alphanumeric in id, e.g.

<amp-state id="x-1">...</amp-state>

<!-- Need to use bracket notation due to "-" in [id]. -->
<p [text]="global['x-1']"></p>

Also some unrelated documentation tweaks in amp-bind.md.

/to @jridgewell

Copy link
Contributor

@jridgewell jridgewell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is global the right name for this?

@dreamofabear
Copy link
Author

Any suggestions? Seems less confusing than self or this.

@dreamofabear dreamofabear merged commit b937ef4 into ampproject:master Aug 7, 2019
@dreamofabear dreamofabear deleted the bind-global branch August 7, 2019 22:33
@jridgewell
Copy link
Contributor

globalThis? That's the new ECMA name.

@dreamofabear
Copy link
Author

Ew... well in this case we don't need to worry about backwards incompatibility with Node.js.

thekorn pushed a commit to edelight/amphtml that referenced this pull request Sep 11, 2019
* Support 'global' var.

* Update docs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

amp-bind: Add keyword for top-level scope
3 participants