Introduces getters and setters for props
and state
properties, so now you
have to access them like real properties on an object instead of calling a
function. Now you can write this
events: {
'click button'() {
// increment the counter when button is clicked
this.state.counter += 1;
}
}
instead of
events: {
'click button'() {
// increment the counter when button is clicked
this.state.counter(this.state.counter() + 1);
}
}
which will greatly simplify your template code :) see full example
You can dynamically add new reactive properties to props
and state
like this:
this.state.addProperty(key, defaultValue);
this.state.addProperties({ key: value, ... }); // multiple at once:
There are two internal helper functions now exposed on the api, which can be useful to re-use in certain situations:
// Wrap a function to be bound to the Template.instance()
TemplateController.bindToTemplateInstance(Function);
// Wrap all functions of the provided object
TemplateController.bindAllToTemplateInstance({ key: Function, ... });
- Make it possible to configure the props cleaning operation of libs like SimpleSchema.
- Fixes weird ecmascript errors in Meteor 1.2.x
- improves error messages and fixes #6
- Adds section about using a single root element to readme
- @Craphtex fixed a bug with setting up template helpers for
state
andprops
if no other helper was defined. - Adds
templateInstance.triggerEvent(eventName, data)
sugar method to promote the best practice of triggering custom events on the first template node like this:this.$(this.firstNode).trigger(eventName, data);
Initial release