Skip to content

Instantly share code, notes, and snippets.

@ericf
Created December 2, 2011 05:47
Show Gist options
  • Select an option

  • Save ericf/1421955 to your computer and use it in GitHub Desktop.

Select an option

Save ericf/1421955 to your computer and use it in GitHub Desktop.
Super basic Y.App example
// Imagine that `Y.User`, `Y.UsersView`, and `Y.UserView` have been defined.
var app = new Y.App({
views: {
users: {
type : Y.UsersView,
preserve: true
},
user: {
type : Y.UserView,
parent: 'users'
}
}
});
app.route('/users/', function () {
this.showView('users');
});
app.route('/users/:id/', function (req) {
var user = new Y.User(req.params.id);
user.load(function () {
app.showView('user', {model: user});
});
});
app.dispatch().render();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment