5
Simple Use Case: YAHOO Object YAHOO Object: Default Members YAHOO.lang Methods
See online docs for complete documentation on each default member of the YAHOO object. dump(obj or arr) returns string
In its simplest usage, the YAHOO global object requires no Member Type Description representation
implementer action; it serves as a container and provider of utility isArray(any) returns boolean
env object Environment object. Contains information about what isBoolean(any) returns boolean
methods to all other components of the YUI Library. YUI modules are loaded and provides a method for isFunction(any) returns boolean
obtaining version information. isNull(any) returns boolean
isNumber(any) returns boolean
Usage: YAHOO.namespace() example object An empty object used as a namespace for example
isObject(any) returns boolean
implementations.
isString(any) returns boolean
YAHOO.namespace(str namespace) lang object Contains utility methods. Full list at right. isUndefined(any) returns boolean
util object Namespace for YUI utilities. Do not add your own hasOwnProperty(obj, property)
Arguments: members to this object returns boolean
(1) namespace: A string containing a single namespace (e.g. tool object Namespace for developer tools like YUITest. Do not augmentObject() general mixin
“myproduct”) or a deeper namespace (e.g. function
add your own memebers to this object. augmentProto() see usage section
“myproduct.weatherModule”). Namespace objects are widget object Namespace for YUI controls (widgets). Do not add extend() see usage section
created within the YAHOO object. your own members to this object. isValue(any) returns false for
Note: Be careful when naming packages. JavaScript reserved words may work as property log method Calls YAHOO.widget.Logger.log; prevents log null/undefined/NaN, else true — note
that false has value and returns true
names in some browsers and not others. messages from throwing errors when the Logger merge(obj1, obj2, …) returns object
Control is not present. with all properties of all args
register method Registers a module with the YAHOO object. substitute() see docs
Usage: YAHOO.lang.augmentObject() trim(string) removes leading/trailing
YAHOO.lang.augmentObject(fn receiver, fn Usage: YAHOO.lang.extend() space
//executes when any YUI module loads, including YAHOO YUI module names: animation,
YAHOO.namespace(fn receiver, fn supplier[, str autocomplete, base, button,
object calendar, colorpicker, connection,
property1, str property2, … , str propertyn]) } container, containercore, datasource,
This function is symmetrical with YAHOO.lang.augmentObject } datatable, dom, dragdrop, editor,
element, event, fonts, grids, history,
(see above); however, it augments only from the supplier’s Note: See Module Info table at right for the format of object passed to your listener function. imageloader, logger, menu, reset,
slider, tabview, treeview, yahoo,
prototype to the receiver’s prototype. Instance members are not Get version information for a YUI component that has been loaded on yuiloader, yuitest.
copied from the supplier to the receiver. the page:
Dependencies var YAHOO.env.getVersion("animation"); //returns module info
object
The YAHOO Global Object is a dependency for all YUI components; it
has no dependencies of its own.