I follow Make Your First Meteor Application book and puzzled to find the following paragraph:
"To begin, we’ll take an old approach for creating helper functions. This approach is deprecated, meaning it’s no longer officially supported, and by the time you’re reading these words, it may not work at all. " while showing the method of adding helper functions:
Template.leaderboard.player = function(){
return "Some other text"
}
Still, when I check official Meteor documentation, it says:
"Each template has a local dictionary of helpers that are made available to it, and this call specifies helpers to add to the template's dictionary.
Example:
Template.myTemplate.helpers({
foo: function () {
return Session.get("foo");
}
});"
So, the only difference between deprecated and new way is replacing one-by-one helper declaration by explicit declaration of all helpers? I could not find any information on when and why this change was done.
The change to the helpers
API was introduced in v0.9.4:
Deprecate the Template.someTemplate.myHelper = ... syntax in favor of Template.someTemplate.helpers(...). Using the older syntax still works, but prints a deprecation warning to the console.
The current version is in place for quite some time and I have not seen the old version used in any current tutorial, so it can probably be ignored.