Why use function callback with name in Templat...onCreated(function callbackName()..)?

Why use function callback with name in Templat…onCreated(function callbackName()…)?

Template.body.onCreated(function bodyOnCreated() {
  this.state = new ReactiveDict();
});

Inside the callback you can call the function itself through the bodyOnCreated variable, though I don’t see any use for it in this case.

It use in Todo Tutorial of Meteor.

It’s just a good habit for debugging… if a problem does arise, it’s much harder to figure out what’s going on when the problem was in an anonymous function called by an anonymous function which was called by an anonymous function which itself was called by an anonymous function from within an anonymous function :slight_smile: