Who is using yui




















Prior to this a basic YUI was included. SimpleYUI loads a number of standard modules and makes them available on the global Y namespace. These include:. Whilst accessing the global Y variable will suffice for many uses, we highly recommend that you look at writing your code within a YUI module.

It is also possible to use one of the other methods to include your JavaScript. It is also possible to use JavaScript within a Database module - see the JavaScript template setting for further information. When using YUI, you can choose which modules you wish to use and the YUI loader will go away and retrieve those modules, determining their dependencies automatically.

This has the effect of separating out the load and execution phases of JavaScript component loading and also allows for asynchronous loading of the code.

For a deeper dive on the benefits of this separation, it's well worth watching this video entitled YUI3 Below the Surface. In order to benefit from these features, it is necessary to wrap your code in a registration function. This wrapper defines the name of the module, wraps the code in a closure to offer module sandboxing, and defines meta-data to inform the loader of any specific dependencies.

A complete wrapper is shown below:. Note: From Moodle 2. JavaScript authoring have moved along considerably in recent years, and we highly recommend that you look at using some of the available tools to help you in your development. The use method will do this for you automatically if necessary, but you could also load a module manually if you wanted to.

We call this static loading since it's the opposite of dynamic loading. This tells YUI to attach all loaded modules to your YUI instance without requiring you to name each module you want to attach. There are four primary ways to configure YUI and each has its own unique benefits. A complete list of configuration options is available in the API Docs. The most common way to specify config options for YUI is to pass them into the YUI constructor when creating a new instance:.

By setting options on the YUI. The global YUI. This can be useful if your module is loaded onto the page in a mashup. The other configuration options do not merge, they are simply an object. Modules are registered globally via add and are later attached to a specific YUI instance via use. The add method accepts two optional arguments after the callback function: a module version string and a config object.

The most useful option in the config object is requires , which allows you to specify an array of other YUI modules that your module requires. YUI will then be sure to load these dependencies before executing your module. After your module has been added via YUI. A module's add callback isn't executed until that module is attached to a YUI instance via use.

Each time a module is attached via use , the module's add callback will be executed, and will receive as an argument the same YUI instance that will later be passed to the use callback. As of version 3. More information on using YUI on Node. If you request a module that is not loaded on the page or a dependency that is not loaded , loader will fetch a copy of that module and its dependencies and attach them to your YUI instance.

This means that any script Loader injects into the page will be loaded asnychronously. This will decrease load time and improve performance by allowing the browser to fetch as many scripts at once as it can.

If your custom modules are properly wrapped in a YUI. Developers rarely require a single, catch-all library. YUI interest waned and usage dropped accordingly. I also suspect there were internal pressures in Yahoo.

YUI is still available and will continue to work for the immediate future — presuming your application has been successfully completed. The situation is less clear for partially-finished projects. Should you continue to develop an application based on a defunct library?



0コメント

  • 1000 / 1000