Reputation: 6185
For meteor I want to create a class that can easily add all created properties to another object.
Normally one would do the following to add properties to a template:
Template.templateName.propertyName = { property: value }
But I want to do something like this:
class TemplateName extends View
propertyName:
property: value
What I need to know is how to construct the View
class above to do this.
EDIT 1:
The View
class should add all properties of it's inheritor to the same-named property of the Template
class.
So, if PostsIndex
extends View
and the property posts
is added to PostsIndex
, then this posts
property with it's value should be added to Template.PostsIndex
.
EDIT 2:
Other options are also welcome, like the following for example:
Template.TemplateName.extendWith ->
propertyName:
property: value
I did not try anything yet, since I have no clue if it's possible or where I need to start.
Is it possible, in a cross-browser way?
Upvotes: 0
Views: 31
Reputation: 6185
Turns out coffeescript can just do it like this:
Template.TemplateName extends
property: value
Upvotes: 0