Paulo Janeiro
Paulo Janeiro

Reputation: 3211

How to know when template from Meteor package has finished rendering

Is there an event/callback that could be used to monitor and run code just after a template from a third-party package has finished rendering? This is because I found that some packages render they content shortly after my other templates render and I would like to able to run code just after each one render. But if third-packages have their own subscriptions then I can't use the onReady callback that I use for my own subscriptions... So, does anyone know a simple way to do this?

Upvotes: 1

Views: 73

Answers (1)

saimeunt
saimeunt

Reputation: 22696

The solution is to use the onRendered template lifecycle event on the specific third party package template you want to track being rendered.

Template.packageTemplate.onRendered(function(){
  //
});

Calling onRendered on a parent template that includes the package template won't work because it will trigger BEFORE its child package template own rendered event.

Upvotes: 1

Related Questions