We know figuring out the process for contributing to an open source project can be intimidating, so we created this issue as a way for you to learn the ropes. (If you feel comfortable contributing to open source projects, please leave this issue for someone else.)
The DOM has a rich event model, e.g. for handling user input. AMP also uses custom events for coordinating behavior across components and modules in the code base. These AMP events follow a naming convention being prefixed with amp:, e.g. amp:built.
Most usages of amp: events today use the string literal directly, for example on this line.
this.element.dispatchCustomEvent('amp:built');
This is nice and simple, but it results in duplication of the amp:built string and has the risk of typos. A better way to do this is to define these events in an enum, like what video-interface#VideoEvents does.
Let's create a new file, src/amp-events.js, that contains an enum defining the commonly used events for AMP components. This will reduce duplication, eliminate the risk of typos, and improve readability of our code base.
'amp:).src/amp-events.js file with an object literal enumerating the events you've found in your search.Fixes #9738 in the description and mention me (@choumx) to get a code review.Once approved, your changes will be merged. ⚡⚡⚡Congrats on making your first contribution to the AMP Project!⚡⚡⚡ You'll be able to see it live across the web soon!
Thanks, and we hope to see more contributions from you soon.
If you have questions ask in this issue or on your Pull Request (if you've created one) or see the How to get help section of the Getting Started guide. Mention me (@choumx) so I can help!
Hi @choumx , I would like to claim this issue.
Hi @choumx . I made the changes as specified in the Pull Request. However, the changes I've made are making the Travis-CI build fail.
It seems adding the src/amp-events.js file as a dependency to various files in the 3p/ and extensions/ folders is violating dependency injection rules. Is it ok if I whitelist these files in build-system/dep-check-config.js?
@abc516 That should be fine since it's just an enum. Thanks!
Hi @abc516; I sent you an invitation to join ampproject on GitHub; once you accept that I think we'll be able to assign this issue to you. Thanks!
OK Joey, I just joined.
On Mon, Jun 19, 2017 at 12:44 PM, Joey Rozier notifications@github.com
wrote:
Hi @abc516 https://github.com/abc516; I sent you an invitation to join
ampproject on GitHub; once you accept that I think we'll be able to assign
this issue to you. Thanks!—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/ampproject/amphtml/issues/9738#issuecomment-309497989,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AH99A4wquoiyuNlYYx5Nhja7SwOZ_DoFks5sFqVxgaJpZM4NxkSF
.
Thanks @abc516!
You are welcome, @mrjoro !