Skip to content

Instantly share code, notes, and snippets.

@brianjmiller
Created July 12, 2012 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianjmiller/3100526 to your computer and use it in GitHub Desktop.
Save brianjmiller/3100526 to your computer and use it in GitHub Desktop.
YUI3: A Start
YUI.add(
"myapp-general",
function (Y) {
var Clazz = Y.namespace("MyApp").General = Y.Base.create(
"myapp-general",
Y.Widget,
[],
{
initializer: function (config) {
Y.log("initializer", "debug", Clazz.NAME);
},
destructor: function () {
Y.log("destructor", "debug", Clazz.NAME);
}
},
{
ATTRS: {}
}
);
},
"0.0.1",
{
requires: [
"widget"
]
}
);
YUI().use("base", "myapp-shopper", function (Y) {
var shopper = new Y.MyApp.Shopper ({ render: true });
});
YUI.add(
"myapp-history",
function (Y) {
var Clazz = Y.namespace("MyApp").History = Y.Base.create(
"myapp-history",
Y.Widget,
[],
{
initializer: function (config) {
Y.log("initializer", "debug", Clazz.NAME);
},
destructor: function () {
Y.log("destructor", "debug", Clazz.NAME);
}
},
{
ATTRS: {}
}
);
},
"0.0.1",
{
requires: [
"widget"
]
}
);
YUI.add(
"myapp-preferences",
function (Y) {
var Clazz = Y.namespace("MyApp").Preferences = Y.Base.create(
"myapp-preferences",
Y.Widget,
[],
{
initializer: function (config) {
Y.log("initializer", "debug", Clazz.NAME);
},
destructor: function () {
Y.log("destructor", "debug", Clazz.NAME);
}
},
{
ATTRS: {}
}
);
},
"0.0.1",
{
requires: [
"widget"
]
}
);
YUI.add(
"myapp-shopper",
function (Y) {
var Clazz = Y.namespace("MyApp").Shopper = Y.Base.create(
"myapp-shopper",
Y.Widget,
[],
{
_preferences: null,
_history: null,
_general: null,
initializer: function (config) {
Y.log("initializer", "debug", Clazz.NAME);
this._preferences = new Y.MyApp.General ();
this._history = new Y.MyApp.History ();
this._general = new Y.MyApp.Preferences ();
},
destructor: function () {
Y.log("destructor", "debug", Clazz.NAME);
},
renderUI: function () {
Y.log("renderUI", "debug", Clazz.NAME);
var cb = this.get("contentBox");
this._preferences.render(cb);
this._history.render(cb);
this._general.render(cb);
}
},
{
ATTRS: {}
}
);
},
"0.0.1",
{
requires: [
'widget',
'myapp-general',
'myapp-preferences',
'myapp-history'
]
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment