I had a similar requirement to know when the footer is rendered in JS.
I built live stats on my footer by putting together a few concepts:
- Add an event listener on document scroll to detect if a div in the footer exists, and record that we’ve seen it in a variable.
- Use Discourse.Route.reopen({ activate: function() { this._super(); … to invalidate the variable when new things load
- Cache my stats so I don’t keep refetching it
If I’m happy with this solution I’ll come back and post it.