• Register
  • Log In
  • Home
  • Quick Start
    • Configurator
    • Download YUI 3
  • Documentation
    • User Guides
    • Examples
    • Tutorials
    • API Docs
  • Community
    • Gallery
    • Blog »
    • Forums
    • YUI Theater
    • Calendar
  • Contribute
    • YUI on GitHub »
    • File a Ticket
    • View Tickets
    • Dashboard
  • Other Projects
    • YUI 2
    • YUI Compressor
    • YUI Doc »
    • YUI Builder
    • YUI PHP Loader
    • YUI Test
    • YUI Website
  • YUI
  • >
  • Community
  • >
  • Gallery

Gallery

Modules

  • Home
  • Featured
  • Popular
  • New
  • All

Documentation

  • FAQ
  • Developer FAQ
  • Developer Guide
  • Module Setup

Tag Cloud

plugin nzakas async davglass io jafl animation model event satyam node apipkin foxxtrot liferay yql greghinch datatable solmsted caridy css form table widget lsmith ericf

Context Navigation

    YUI Library is not responsible for bugs or support with this module. It is available as a free service. For support please contact the module owner with the provided links.

    NodeJS YUI3 (gallery-nodejs)

    Last Updated: 03/23/10
    + 3 -

    Dav Glass

    YUI Developer

    See 9 more by this user.

    Featured Item

    Created: 02/19/10
    Project: YUI 3
    License: YUI BSD
    YUI Version: 3.0.0
    Free for use.

    This module allow you to run the latest YUI 3.x source inside a Node.js process.

    • Tags:
    • serverside
    • nodejs
    • davglass
    • Download
    • Docs
    • Homepage
    • Bugs
    • Source
    • Example
    • Forum
    • History

    Code Sample

    // 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));
                }
            }
        });
     
     
    });

    Forum Posts

    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