We need to get rid of Template.X.X

Why must I type/copy Template every time I want a new helper or event?

Template.main.helpers
Template.main.events
Template.home.helpers
Template.home.events

It should be What do we want and what we want to do it with. Is the logical syntax.

events.Template({
//do something
})

So much repetition and ugliness for one file.

What would the solution be in your opinion?

Current implemenatation:
Template - keyword that covers all of the templates
templateName - refers to the needed template
events/helpers/onCreated etc. - data specific to the template

Your implementation:
events/onCreated/onDestroyed etc
templateName

Youre hogging a bunch of global variables with little benefit. Ends up being pretty similar syntax IMO, you’re just removing Template from it, which is actually pretty useful there in the front.

Somewhere global do var T = Template.

Then T.main.events should work :smile:

The current implementation seems disjointed. I would have preferred something like:

Template.main({
  onCreated: function() {
  },
  helpers: {
  },
  events: {
  }
})

But then again, I have one js file per template so it’s not that big of a deal to me.

1 Like

That syntax could be easily added by a package, I’d encourage you to write one and post it here.

1 Like