YUI recommends YUI 3.

YUI 2 has been deprecated since 2011. This site acts as an archive for files and documentation.

Yahoo! UI Library

YAHOO Global  2.3.1

Yahoo! UI Library > yahoo > YAHOO

Show Private Show Protected

static Class YAHOO

The YAHOO global namespace object. If YAHOO is already defined, the existing YAHOO object will not be overwritten so that defined namespaces are preserved.

Methods

augment

static void augment ( r , s , arguments )
An alias for YAHOO.lang.augment
Parameters:
r <Function> the object to receive the augmentation
s <Function> the object that supplies the properties to augment
arguments <String*> zero or more properties methods to augment the receiver with. If none specified, everything in the supplier will be used unless it would overwrite an existing property in the receiver
Returns: void

extend

static void extend ( subc , superc , overrides )
An alias for YAHOO.lang.extend
Parameters:
subc <Function> the object to modify
superc <Function> the object to inherit
overrides <Object> additional properties/methods to add to the subclass prototype. These will override the matching items obtained from the superclass if present.
Returns: void

log

static Boolean log ( msg , cat , src )
Uses YAHOO.widget.Logger to output a log message, if the widget is available.
Parameters:
msg <String> The message to log.
cat <String> The log category for the message. Default categories are "info", "warn", "error", time". Custom categories can be used as well. (opt)
src <String> The source of the the message (opt)
Returns: Boolean
True if the log operation was successful.

namespace

static Object namespace ( arguments )
Returns the namespace specified and creates it if it doesn't exist
YAHOO.namespace("property.package");
YAHOO.namespace("YAHOO.property.package");
Either of the above would create YAHOO.property, then YAHOO.property.package Be careful when naming packages. Reserved words may work in some browsers and not others. For instance, the following will fail in Safari:
YAHOO.namespace("really.long.nested.namespace");
This fails because "long" is a future reserved word in ECMAScript
Parameters:
arguments <String*> 1-n namespaces to create
Returns: Object
A reference to the last namespace object created

register

static void register ( name , mainClass , data )
Registers a module with the YAHOO object
Parameters:
name <String> the name of the module (event, slider, etc)
mainClass <Function> a reference to class in the module. This class will be tagged with the version info so that it will be possible to identify the version that is in use when multiple versions have loaded
data <Object> metadata object for the module. Currently it is expected to contain a "version" property and a "build" property at minimum.
Returns: void


Copyright © 2007 Yahoo! Inc. All rights reserved.