Tyro is another (super-lightweight) JavaScript (MVC) framework inspired by Backbone, CorMVC and Sammy.
Tyro aids in building single page web applications without prescribing too much!
Tyro lets you, the developer decide how to structure your application - after all, it should be designed and built to your custom specification. Technically speaking, you could use Tyro without any models and views and instead munge all the layers into the controllers, but of course we don't advise this!
Tyro has a few dependencies, but these could easily be ripped / swapped out and changed to whatever you want. Currently Tyro is built on top of jQuery and jQuery.HashChange (you know the guy that wrote jQuery BBQ).
- Reacting to hash changes via 'routes'
- Kicking off controllers
- Setting the hash value
As we said, it's tiny but that coupled with an example app (still todo) should show you how easy it is to build a lovely, architected, MVC single page web application.
It's completely up to you how you build your application but we have to recommend the following:
- jQuery Templates (they are super awesome)
- jQuery PubSub (useful to get your application talking to each without coupling)
new Tyro({
pageNotFoundUrl: "/404",
routeMatched: function(url) {
// do something if you want
// in our example we are publishing an event that the url was changed, so that lots of
// different views can update themselves based on the current matched url. Useful for
// highlighting the current menu item.
}
})