JeffD23
JeffD23

Reputation: 9298

Meteor: Applying the onCreated callback to all templates

I want to run some code on the onCreated event in meteor in every template.

I know meteor allows helpers to apply to all templates:

Template.registerHelper("example", function() {
  // do something
});

But is it possible to register a function that will apply to every onCreated event?

Upvotes: 3

Views: 154

Answers (1)

David Weldon
David Weldon

Reputation: 64312

You need to use a package like template-extension:

meteor add aldeed:template-extension

Then you can do this:

Template.onCreated(function () {
  // do something
});

Upvotes: 2

Related Questions