This example shows how to use the core of YUI.

{{>yui-core}}

Setting up the YUI Instance

Here we will create our `YUI` instance, loading `node` so we can work with DOM elements in the example.

``` YUI().use('node', ... ```

Using the callback

The use method will dynamically fetch anything required for `Node` if it isn't already on the page. If dynamic loading is required, the last parameter supplied to use should be a function to execute when the load is complete. This function will be executed whether or not dynamic loading is required, so it is the preferred pattern for using YUI.

``` YUI().use('node', function(Y) ... ```

The function is supplied a reference to the YUI instance, so we can wrap all of our implementation code inside of the use statement without saving an external reference to the instance somewhere else.

Now that we know all of the modules are loaded, we can use `Node` to update DOM nodes in many ways. Here's a simplified version of the fruit example above.

{{>yui-core-simple}}
``` {{>yui-core-simple}} ```

Full Source

Here's the full source of the fruit example.

``` {{>yui-core}} ```