-
Notifications
You must be signed in to change notification settings - Fork 19
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
Add event when highlight event listener is registered #27
base: master
Are you sure you want to change the base?
Conversation
If you place prism highlighter in another component, there's no way to know when the highlight event listener is registered, resulting in a possible race condition - highlight events being sent out before the event listener is even registered. By firing a (prism-highlighter-highlight-event-registered) event after the listener is registered, the host can listen for the fired event, and act accordingly.
Added references to how to make shadow dom work.
Firing event when highlight event listener is registered If you place prism highlighter in another component, there's no way to know when the highlight event listener is registered, resulting in a possible race condition - highlight events being sent out before the event listener is even registered. By firing a (prism-highlighter-highlight-event-registered) event after the listener is registered, the host can listen for the fired event, and act accordingly. I've also improved shadow dom documentation, and added references to how to make shadow dom work.
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
Hi guys, I signed it! Thanks, T +1 925 242 6831 From: googlebot [email protected] Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.
— |
CLAs look good, thanks! |
Thanks for the PR @runn-vermel! I'd like to discuss the bigger problem in #26 and see if we can find a solution that doesn't involve adding/documenting/relying on adding more events to solve the race condition. |
haha - I completely understand. This is a band-aid, for sure. But... it's a band aid that works NOW. I fully agree this should probably be re-written, but in the meantime.... |
Fix #26
@arthurevans
If you place prism highlighter in another component, there's no way to know when the highlight event listener is registered, resulting in a possible race condition - highlight events being sent out before the event listener is even registered.
By firing a (prism-highlighter-highlight-event-registered) event after the listener is registered, the host can listen for the fired event, and act accordingly.