server Class
Provides a set of features to control a YUI instance on the server side.
Item Index
Methods
Methods
ready
-
callback
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
Functionwhen the app is ready. If an error occurr, the error object will be passed as the first argument of the callback function.
registerBundle
-
bundle
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
ObjectA locator bundle reference.
require
()
public
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
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:
Y instance