bmarian / token-tooltip-alt

A module that adds a tooltip next to the currently hovered token to show some useful information for players and DMs.
MIT License
9 stars 15 forks source link

[FEATURE REQUEST] Function call on rendered tooltip #68

Closed Moerill closed 3 years ago

Moerill commented 3 years ago

Describe the solution you'd like Give some sort of way to modify the rendered tooltip, without using a timeout.

Possible solution: Attach a promise to the tooltip class, which will get resolved when rendering finished. This could look similar to:

tooltip.finishedRendering.then( (html) => {
  // modify the HTML
});
return '';

Describe alternatives you've considered Using timeouts.. but thats kinda difficult to "time right"

bmarian commented 3 years ago

Here it is

tooltip.renderingFinished.then(($html) => {
    /* YOUR CODE HERE */
});

return '';