Are custom javascript events fired after ajax render?


(Mikulas Dite) #1

Could anybody please clarify what javascript event does Discourse fire after it has rendered a page requested with ajax?

I’m setting up MathJax latex rendering and has to redraw after the page has rendered. I might hook the ajax success event, but that one does not imply the page has changed.


(Kane York) #2

For future travelers, you want the decorateCooked function now.

import { decorateCooked } from 'discourse/lib/plugin-api';
// or
var decorateCooked = require('discourse/lib/plugin-api').decorateCooked;

#3

Can a variant of this be used on the client to signal to custom client side JS that a new page has been loaded via ajax?

Or if not, is there such an event?