Use .onRendered for global?

I create the Blaze Layout

<template name="appLayout">
  {{> Template.dynamic template=main }}

Could I use template level


Maybe I do not quite understand your question, but in the above example, you also will have

<template name="main">
  <!-- content -->

And of course, that may use its onRendered() etc.

I use FlowRouter, BlazeLayout and fezvrasta:bootstrap-material-design.
I would like to init the $.material.init(); for all of content template rendered.
But I do this many time on the all content

<template name="home">

<template name="about">


So I want to config this for all.
Please help me.

So you are looking for ONE global Template.all.onRendered() hook which is done everytime a template gets created, rendered, … ?

P.S.: In that case you should change your title and question and use your second comment instead

Thanks for your advice, please example for me.

Google is your friend if look for the right question:


Look great, thanks again.
Excuse me, this solution make the project slow or not?

Why should it?

It just inserts an additional onRendered function to your templates.

Same as you can do like

Template.main.onRendered(function () {
  // do this

Template.main.onRendered(function () {
  // do that

A template may gets registered more than one function.

The Meteor.startup() will just insert that function once on startup.

Update: At least any line of code will slow down your app. Best app in case of performance is:

function main() {}


Thanks again for your helping.