Skip to content

Instantly share code, notes, and snippets.

@woeye
Created March 23, 2012 15:18
Show Gist options
  • Save woeye/2171663 to your computer and use it in GitHub Desktop.
Save woeye/2171663 to your computer and use it in GitHub Desktop.
Creating a view in YUI 3.5.0PR4
YUI().use('app', 'view', function(Y) {
// Configure all views
/* This one won't work - because Y.HomeView is an instance already
Y.HomeView = new Y.View();
Y.HomeView.render = function() {
Y.log('inside HomeView');
return this;
};*/
// This one will work - because Y.HomeView is an class object and thus 'new Y.HomeView()' will work
Y.HomeView = Y.Base.create('homeView', Y.View, [], {
render: function() {
Y.log('inside HomeView');
return this;
}
});
var app = new Y.App({
transitions: true,
views: {
home: { type: 'HomeView' }
}
});
app.route('/', function() {
this.showView('home');
});
app.render().dispatch();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment