Name | Date | Size | |
---|---|---|---|
.. | 2012-04-03 21:39:14 | 100 | |
build-features.properties | 2011-06-16 15:55:55 | 687 | |
build-features.xml | 2010-08-17 22:15:30 | 303 | |
build-intl-base.properties | 2011-06-16 15:55:55 | 675 | |
build-intl-base.xml | 2010-02-16 20:34:48 | 304 | |
build-later.properties | 2011-06-16 15:55:55 | 675 | |
build-later.xml | 2009-08-12 23:15:00 | 300 | |
build-log-nodejs.properties | 2011-10-11 17:45:54 | 684 | |
build-log-nodejs.xml | 2011-10-11 17:45:54 | 305 | |
build-log.properties | 2011-06-16 15:55:55 | 671 | |
build-log.xml | 2009-08-12 23:15:00 | 298 | |
build-yui.xml | 2011-06-09 17:37:26 | 554 | |
build.properties | 2011-11-24 23:10:57 | 556 | |
build.xml | 2011-11-08 16:05:44 | 941 | |
core-extras.xml | 2012-04-03 21:39:14 | 2.1 KiB | |
docs | 2012-03-30 17:58:47 | 28 | |
HISTORY.md | 2012-02-06 20:09:31 | 9.1 KiB | |
js | 2012-04-02 16:47:04 | 19 | |
Makefile | 2012-04-03 21:39:14 | 176 | |
meta | 2011-11-24 23:10:57 | 3 | |
nodejs-seed.properties | 2011-11-24 23:10:57 | 681 | |
nodejs-seed.xml | 2011-10-11 17:45:54 | 512 | |
npm.properties | 2012-02-01 16:52:21 | 23 | |
npm.xml | 2012-02-01 17:04:45 | 1.1 KiB | |
README.md | 2011-06-24 22:06:53 | 1.5 KiB | |
README.nodejs.md | 2011-10-11 20:12:18 | 2.7 KiB | |
scripts | 2012-02-02 16:12:06 | 7 | |
tests | 2012-04-02 16:47:04 | 24 | |
yui-base.properties | 2011-11-24 23:10:57 | 1.3 KiB | |
yui-base.xml | 2011-06-16 15:55:55 | 655 | |
yui-core.properties | 2011-11-08 16:05:44 | 969 | |
yui-core.xml | 2011-06-16 15:55:55 | 655 |
README.md
YUI Core
========
Provides core YUI functionality, including module registration and usage,
language/array/object utilities, browser detection, and dynamic loading of
script and css files.
The `yui` module is a rollup of `yui-base` (the core module registration and
sandbox system, plus utilities), and the following optional submodules:
* `yui-base`: The Modules required to make YUI run
* `loader`: Provides dynamic module loading.
`yui-base` contains:
* `yui-core`: The Modules required to make YUI run
* The module registration system (`YUI.add()` and `YUI().use()`).
* Core YUI utilities such as `cached()`, `merge()` and `mix()`.
* `Lang`: Language utilities, type checking, etc.
* `Object`: Object manipulation and iteration utilities.
* `Array`: Array manipulation and iteration utilities.
* `get`: Provides dynamic loading of JavaScript and CSS
* `yui-log`: Adds support for `Y.log()` and friends.
* `yui-later`: An abstraction around `setTimeout` and `setInterval`.
* `intl-base`: Provides dynamic loading of language packs.
`yui-core` contains:
* The module registration system (`YUI.add()` and `YUI().use()`).
* Core YUI utilities such as `cached()`, `merge()` and `mix()`.
* `Lang`: Language utilities, type checking, etc.
* `Object`: Object manipulation and iteration utilities.
* `Array`: Array manipulation and iteration utilities.
**NOTE** As of 3.4.0PR2 yui-throttle is not in the core yui package, it's a standalone module.
README.nodejs.md
YUI in NodeJS
=============
The YUI system needs to be built in order for it to work inside of NodeJS properly.
We have created a script to do this for you so you can create an npm packge that's
installable and usable locally.
We have also created a new seed file for YUI inside of node (`yui-nodejs`) that
loads all of the YUI modules needed to make YUI run on node properly.
Installation
------------
To create the package you need `bash`, `make`, `node` and `npm` installed.
cd yui3/src/yui
make npm
By default this will create the package here:
Then you can use `npm` to install this package like this:
mkdir yui_test
cd yui_test
npm i /tmp/npm-yui/
Now `npm ls` will show that the package is installed locally in this directory.
Usage
-----
Once the yui package has been installed, you can still access it like you used to:
```javascript
var YUI = require('yui').YUI;
YUI().use('oop', function(Y) {
console.log('OOP?', (Y.rbind) ? true : false); //true
});
```
We have also added support for YUI "requiring" in a more "CommonJS" manner:
```javascript
var Y = require('yui/base-base');
console.log('Base?', (Y.Base) ? true : false); //true
var Y = require('yui/yql');
console.log('YQL?', (Y.YQL) ? true : false); //true
```
When you require a YUI module more than once in a process, the YUI instance
used under the hood is shared.
```javascript
var Y = require('yui/yql');
console.log('YQL #1?', (Y.YQL) ? true : false); //true
console.log('Base #1?', (Y.Base) ? true : false); //false
var Y = require('yui/base-base');
console.log('YQL #2?', (Y.YQL) ? true : false); //true
console.log('Base #2?', (Y.Base) ? true : false); //true
```
You can also do one YUI use on require and load several modules at once:
```javascript
var Y = require('yui').use('yql', 'oop', 'base-base');
console.log('OOP?', (Y.rbind) ? true : false); //true
console.log('YQL?', (Y.YQL) ? true : false); //true
console.log('Base?', (Y.Base) ? true : false); //true
```
Sync vs Async
-------------
Doing a require, like above, where you select your modules inside the require will
make that YUI instance sync by default:
```javascript
//This will be sync
var Y = require('yui').use('yql', 'oop', 'base-base');
```
Using YUI like you do in the browser will make YUI async:
```javascript
var YUI = require('yui').YUI;
//This will be async
YUI().use('oop', function(Y) {
console.log('OOP?', (Y.rbind) ? true : false); //true
});
```
You can force a sync use by setting the `useSync` config option in they YUI constructor:
```javascript
var YUI = require('yui').YUI;
//This is sync
var Y = YUI({ useSync: true }).use('oop');
console.log('OOP?', (Y.rbind) ? true : false); //true
```