Library
The
Composite Application Framework library dynamically loads script files on demand. With
the
Library.register(id,
url) method, you can register a named group of script files to load
later. The
Library.load(id,
onload) method loads the named group or directly-specified group of
script files, and then executes the specified callback method when loading is
completed. For example, the scripts needed to execute
Scriptaculous Effects
are pre-registered as the scriptaculous/effects group. To execute a
scriptaculous effect, you must call Library.load() to load the scriptaculous
effect library, pass a method to execute once the library has finished loading.
For example:
Library.load("scriptaculous/effects", function() {
Effect.Fade("myElement");
});Instead of using a registered group name, you also can pass Library.load() the URL of a script to load directly. You can specify multiple URLs or named groups as a space-separated string, for example http://example.com/foo.js http://example.com/bar.js.