moot/riotjs — pull request #47 by 3den (2013-11-15 07:06:07+00:00)
Title: Flexible and decoupled presenters.

Currently it is hard to reuse presenters and they are very coupled to specific models and controllers. Thats problem is shared by most MVC frameworks too. But we can do better than that!

What if you could create some generic presenters and use then in different contexts? What you could easily unit test your presenter without decencies? We can do that!

The idea is to define a presenter just once:

```js
$.prensent("awesome-stuff", function (element, options) {
... do some awesome stuff here
});
```

And than just atach that presenter to the elements that should use it,.and you can also customise the options:

```js
$("#cool-element").present("awesome-stuff", {model: coolModel);
$("#awesome-element").present("awesome-stuff", { model: myAwesomeModel});
```

As you can see the present works like a plugin so you can attach several presenters to the same element.