-
Notifications
You must be signed in to change notification settings - Fork 12
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
Visual diff: trigger DOM_CHANGED
event after enable/disable
#465
Conversation
A new event `READTHEDOCS_ROOT_DOM_CHANGED` is triggered when the "Visual diff" is enabled/disabled after the DOM was modified. This allows other addons to subscribe to this event to re-initialize if required. I used this event from links preview to call `setupTooltips` again to re-install tooltips on these links. I migrated links preview to a `LitElement` to be able to make usage of this pattern and follow what we already had. We will be able to do something similar on #157
…diff-dom-changed-event
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.
Looks like a nice refactor to me.
@@ -9,6 +9,8 @@ export const EVENT_READTHEDOCS_FLYOUT_SHOW = "readthedocs-flyout-show"; | |||
export const EVENT_READTHEDOCS_FLYOUT_HIDE = "readthedocs-flyout-hide"; | |||
export const EVENT_READTHEDOCS_ADDONS_DATA_READY = | |||
"readthedocs-addons-data-ready"; | |||
export const EVENT_READTHEDOCS_ROOT_DOM_CHANGED = |
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.
Should we have a docstring or similar to describe the events 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.
Added 👍🏼
A new event
READTHEDOCS_ROOT_DOM_CHANGED
is triggered when the "Visual diff" is enabled/disabled after the DOM was modified.This allows other addons to subscribe to this event to re-initialize if required. I used this event from links preview to call
setupTooltips
again to re-install tooltips on these links.I migrated links preview to a
LitElement
to be able to make usage of this pattern and follow what we already had.We will be able to do something similar on #157
Closes #460