API Docs for: 0.2.0
Show:

server Class

Provides a set of features to control a YUI instance on the server side.

Item Index

Methods

ready

(
  • callback
)
public

Defined in lib/server.js:101

Waits for the app to be ready, including the YUI instance to notify back that the ready state of the app was reached by calling the callback. The ready state is bound to the locator instance mounted into the express app thru app.set('locator', locator); and depending on app.get('locator').ready.then() promise result, the ready state will be reached or not.

app.yui.ready(function (err) {
    if (err) {
        throw err;
    }
    // do something!
});

Parameters:

  • callback Function

    when the app is ready. If an error occurr, the error object will be passed as the first argument of the callback function.

registerBundle

(
  • bundle
)
public chainable

Defined in lib/server.js:32

Create a synthetic group off the bundle renference to register its modules into the server and/or client Y instance so they can be used thru app.yui.use().

Parameters:

  • bundle Object

    A locator bundle reference.

require

() public

Defined in lib/server.js:150

Creates a YUI Instance, and wraps the call to Y.require() to work appropiatly on the server side. The require method can be called once the ready state is achieved thru app.yui.ready().

app.yui.ready(function (err) {
    if (err) {
        throw err;
    }
    app.yui.require('json-stringify', function (Y, imports) {
        Y.JSON.stringify({ entry: 'value' });
    });
});

use

() Object public

Defined in lib/server.js:237

Creates a YUI Instance, and wraps the call to Y.use() to work appropiatly on the server side. The use method can be called once the ready state is achieved thru app.yui.ready().

app.yui.ready(function (err) {
    if (err) {
        throw err;
    }
    app.yui.use('json-stringify', function (Y) {
        Y.JSON.stringify({ entry: 'value' });
    });
});

Returns:

Object:

Y instance