// load YUI
var YUI = require("./lib/node-yui3").YUI;
//sys.puts('After: ' + sys.inspect(process.memoryUsage()));
//Now use non-DOM related YUI utilities
YUI({
filter: 'debug',
debug: true
}).use('gallery-yql', 'json', 'base', 'io-nodejs', function(Y) {
//sys.puts('Inside: ' + sys.inspect(process.memoryUsage()));
//Logger outputs with sys.puts
Y.log('This is a test');
//Lang is available
Y.log('Test: ' + Y.Lang.isBoolean(true), 'debug', 'myapp');
//Creating a simple class
var One = function() {
One.superclass.constructor.apply(this, arguments);
};
//Extending it with Y.Base so we have Custom Events and a lifecycle
Y.extend(One, Y.Base, {
test: function() {
this.publish('foo', {
emitFacade: true
});
this.fire('foo');
}
}, {
NAME: 'one'
});
//Create a new instance of our new class
var o = new One();
o.on('foo', function(o) {
Y.log('Foo Fired', 'debug', 'myapp');
//Y.log(o, 'debug');
});
o.test(); //Should fire the one:foo Event.
//Make a YQL query
var q1 = new Y.yql('select * from github.user.info where (id = "davglass")');
q1.on('query', function(r) {
//Do something here.
sys.puts(sys.inspect(r));
});
var url = 'http:/'+'/yuilibrary.com/gallery/api/user/davglass';
Y.io(url, {
xdr: {
use: 'nodejs'
},
on: {
start: function() {
Y.log('Start IO', 'info', 'TEST');
},
success: function(id, o) {
//Y.log(o.responseText);
Y.log(Y.JSON.parse(o.responseText));
}
}
});
});| Subject | Author | Date |
|---|---|---|
| configureYUI is not defined | khael | 04/19/11 |
| Re: configureYUI is not defined | Dav Glass | 04/19/11 |
| Can this be added to the npm registry? | John Lindal | 09/6/11 |
| Re: Can this be added to the npm registry? | John Lindal | 09/6/11 |
© 2006-2011 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info