I have this Meteor project: https://github.com/jfahrenkrug/code_buddy
It's basically a tool with a big textarea and a pre area that lets you enter source code snippets that automatically get pushed to all connected clients.
I'd like to automatically run the highlightSyntax function when the code was changed, but it doesn't really work.
I've tried query.observe, but that didn't work too well: The syntax highlight flashed up once and then disappeared again.
So my question is: How do I run code after the DOM was updated?
As for the current version of Meteor (1.0), we can now use the .afterFlush() function of Tracker.
I just found a little hack that seems to be working pretty well:
I'm not a Meteor expert so it might have some downsides, but I haven't found any for now — except that it's a bit dirty !
I think you might want to pass a callback to
see http://docs.meteor.com/#meteor_startup