Created
March 23, 2012 15:18
-
-
Save woeye/2171663 to your computer and use it in GitHub Desktop.
Creating a view in YUI 3.5.0PR4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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