meteor/meteor — pull request #612 by cmather (2013-01-16 20:10:41+00:00)
Title: Pluggable templates.

This is an initial sketch! Hope you have time to take a look.

Actual example with form parsing: https://github.com/cmather/meteor-pluggable-templates-example.

Adds ability to plug functionality into templates. A plugin can have its
own created, rendered and destroyed callbacks, as well as define its own
events.

Example:

```javascript
SimpleForm = function (options) {};
SimpleForm.prototype = {
constructor: SimpleForm,
created: function (template) {
// this points to SimpleForm instance
},
rendered: function (template) {},
destroyed: function (template) {},
events: {},

serialize: function () {},
onSubmit: function () {}
};

SomeOtherPlugin = function (options) {};

Template.myForm.plugins({
"someName": new SimpleForm({ selector: "form" }),
"someOtherPlugin": new SomeOtherPlugin({});
});
```