API Docs for: 3.8.0
Show:

config Class

Defined in: yui/js/yui.js:1500
Module: yui-base
Parent Module: yui

Config object that contains all of the configuration options for this YUI instance.

This object is supplied by the implementer when instantiating YUI. Some properties have default values if they are not supplied by the implementer.

This object should not be updated directly because some values are cached. Use applyConfig() to update the config object on a YUI instance that has already been configured.

Properties

2in3

String

Defined in yui/js/yui.js:1934

Available since 3.1.0

Revision number of YUI 2in3 modules that should be used when loading YUI 2in3.

Default: "4"

aliases

Object

Defined in yui/js/yui.js:1834

Aliases are dynamic groups of modules that can be used as shortcuts.

Example:

YUI({
    aliases: {
        davglass: [ 'node', 'yql', 'dd' ],
        mine: [ 'davglass', 'autocomplete']
    }
}).use('mine', function (Y) {
    // Node, YQL, DD & AutoComplete available here.
});

base

String

Defined in yui/js/yui.js:1671

Base directory for dynamic loading.

bootstrap

Boolean

Defined in yui/js/yui.js:1515

If true (the default), YUI will "bootstrap" the YUI Loader and module metadata if they're needed to load additional dependencies and aren't already available.

Setting this to false will prevent YUI from automatically loading the Loader and module metadata, so you will need to manually ensure that they're available or handle dependency resolution yourself.

Default: true

cacheUse

Boolean deprecated

Defined in yui/js/yui.js:1989

Deprecated: No longer used.

Available since 3.3.0

Cache serviced use() requests.

Default: true

combine

Boolean

Defined in yui/js/yui.js:1739

If true, YUI will use a combo handler to load multiple modules in as few requests as possible.

The YUI CDN (which YUI uses by default) supports combo handling, but other servers may not. If the server from which you're loading YUI does not support combo handling, set this to false.

Providing a value for the base config property will cause combine to default to false instead of true.

Default: true

comboBase

String

Defined in yui/js/yui.js:1677

Base URL for a dynamic combo handler. This will be used to make combo-handled module requests if combine is set to `true.

Default: "http://yui.yahooapis.com/combo?"

core

Array

Defined in yui/js/yui.js:1606

A list of modules that defines the YUI core (overrides the default list).

Default: ['get', 'features', 'intl-base', 'yui-log', 'yui-later', 'loader-base', 'loader-rollup', 'loader-yui3']

cssAttributes

Object

Defined in yui/js/yui.js:1780

Object hash containing attributes to add to dynamically added <link> nodes.

dateFormat

String deprecated

Defined in yui/js/yui.js:1629

Deprecated: Use configuration in `DataType.Date.format()` instead.

Default date format.

debug

Boolean

Defined in yui/js/yui.js:1527

If true, Y.log() messages will be written to the browser's debug console when available and when useBrowserConsole is also true.

Default: true

delayUntil

Object | String

Defined in yui/js/yui.js:2010

Available since 3.6.0

Event to wait for before executing the use() callback.

The following events are supported:

  • available
  • contentready
  • domready
  • load

The event may be specified as a string or as an object hash that provides additional event configuration, as illustrated in the example below.

Example:

You can use load or domready strings by default:

YUI({
    delayUntil: 'domready'
}, function (Y) {
    // This will not execute until 'domeready' occurs.
});

Or you can delay until a node is available (with available or contentready):

YUI({
    delayUntil: {
        event: 'available',
        args : '#foo'
    }
}, function (Y) {
    // This will not execute until a node matching the selector "#foo" is
    // available in the DOM.
});

doc

Document

Defined in yui/js/yui.js:1597

The browser document object associated with this YUI instance's win object.

When running in Node.js, this property is undefined, since there is no document object.

errorFn

Function

Defined in yui/js/yui.js:1951

Available since 3.2.0

Callback to execute when Y.error() is called. It receives the error message and a JavaScript error object if one was provided.

This function is executed with the YUI instance as its this object.

Returning true from this function will prevent an exception from being thrown.

Sub-properties:

  • msg String

    Error message

  • [err] Object optional

    Error object (if one was provided).

fetchCSS

Boolean | String

Defined in yui/js/yui.js:1906

If true, YUI will attempt to load CSS dependencies and skins. Set this to false to prevent YUI from loading any CSS, or set it to the string "force" to force CSS dependencies to be loaded even if their associated JS modules are already loaded.

Default: true

filter

Object | String

Defined in yui/js/yui.js:1694

Filter to apply to module urls. This filter will modify the default path for all modules.

The default path for the YUI library is the minified version of the files (e.g., event-min.js). The filter property can be a predefined filter or a custom filter. The valid predefined filters are:

  • debug: Loads debug versions of modules (e.g., event-debug.js).
  • raw: Loads raw, non-minified versions of modules without debug logging (e.g., event.js).

You can also define a custom filter, which must be an object literal containing a search regular expression and a replacement string:

myFilter: {
    searchExp : "-min\\.js",
    replaceStr: "-debug.js"
}

filters

Object

Defined in yui/js/yui.js:1732

Hash of per-component filter specifications. If specified for a given component, this overrides the global filter config.

force

String[]

Defined in yui/js/yui.js:1760

Array of module names that should always be loaded when required, even if already present on the page.

global

Object

Defined in yui/js/yui.js:1578

Reference to the global object for this execution context.

In a browser, this is the current window object. In Node.js, this is the Node.js global object.

groups

Object

Defined in yui/js/yui.js:1851

A hash of module group definitions.

For each group you can specify a list of modules and the base path and combo spec to use when dynamically loading the modules.

Example:

groups: {
    yui2: {
        // specify whether or not this group has a combo service
        combine: true,

        // The comboSeperator to use with this group's combo handler
        comboSep: ';',

        // The maxURLLength for this server
        maxURLLength: 500,

        // the base path for non-combo paths
        base: 'http://yui.yahooapis.com/2.8.0r4/build/',

        // the path to the combo service
        comboBase: 'http://yui.yahooapis.com/combo?',

        // a fragment to prepend to the path attribute when
        // when building combo urls
        root: '2.8.0r4/build/',

        // the module definitions
        modules:  {
            yui2_yde: {
                path: "yahoo-dom-event/yahoo-dom-event.js"
            },
            yui2_anim: {
                path: "animation/animation.js",
                requires: ['yui2_yde']
            }
        }
    }
}

ignore

String[]

Defined in yui/js/yui.js:1754

Array of module names that should never be dynamically loaded.

injected

Boolean

Defined in yui/js/yui.js:1558

When the YUI seed file is dynamically loaded after the window.onload event has fired, set this to true to tell YUI that it shouldn't wait for window.onload to occur.

This ensures that components that rely on window.onload and the domready custom event will work as expected even when YUI is dynamically injected.

Default: false

insertBefore

HTMLElement | String

Defined in yui/js/yui.js:1767

DOM element or id that should be used as the insertion point for dynamically added <script> and <link> nodes.

jsAttributes

Object

Defined in yui/js/yui.js:1774

Object hash containing attributes to add to dynamically added <script> nodes.

lang

String | String[]

Defined in yui/js/yui.js:1614

A list of languages to use in order of preference.

This list is matched against the list of available languages in modules that the YUI instance uses to determine the best possible localization of language sensitive modules.

Languages are represented using BCP 47 language tags, such as "en-GB" for English as used in the United Kingdom, or "zh-Hans-CN" for simplified Chinese as used in China. The list may be provided as a comma-separated string or as an array.

loaderPath

String

Defined in yui/js/yui.js:1896

Path to the Loader JS file, relative to the base path.

This is used to dynamically bootstrap the Loader when it's needed and isn't yet available.

Default: "loader/loader-min.js"

loadErrorFn

Function

Defined in yui/js/yui.js:1965

Available since 3.3.0

A callback to execute when Loader fails to load one or more resources.

This could be because of a script load failure. It could also be because a module fails to register itself when the requireRegistration config is true.

If this function is defined, the use() callback will only be called when the loader succeeds. Otherwise, use() will always executes unless there was a JavaScript error when attaching a module.

locale

String deprecated

Defined in yui/js/yui.js:1636

Deprecated: Use `config.lang` instead.

Default locale.

logExclude

Object

Defined in yui/js/yui.js:1551

A hash of log sources that should be not be logged. If specified, all sources will be logged except those on this list.

logFn

Function

Defined in yui/js/yui.js:1942

Available since 3.1.0

Alternate console log function that should be used in environments without a supported native console. This function is executed with the YUI instance as its this object.

logInclude

Object

Defined in yui/js/yui.js:1543

A hash of log sources that should be logged. If specified, only messages from these sources will be logged. Others will be discarded.

modules

Object

Defined in yui/js/yui.js:1803

A hash of module definitions to add to the list of available YUI modules. These modules can then be dynamically loaded via the use() method.

This is a hash in which keys are module names and values are objects containing module metadata.

See Loader.addModule() for the supported module metadata fields. Also see groups, which provides a way to configure the base and combo spec for a set of modules.

Example:

modules: {
    mymod1: {
        requires: ['node'],
        fullpath: '/mymod1/mymod1.js'
    },

    mymod2: {
        requires: ['mymod1'],
        fullpath: '/mymod2/mymod2.js'
    },

    mymod3: '/js/mymod3.js',
    mycssmod: '/css/mycssmod.css'
}

onCSS

Function

Defined in yui/js/yui.js:1793

Callback for the 'CSSComplete' event. When dynamically loading YUI components with CSS, this property fires when the CSS is finished loading.

This provides an opportunity to enhance the presentation of a loading page a little bit before the entire loading process is done.

pollInterval

Number

Defined in yui/js/yui.js:1643

Default generic polling interval in milliseconds.

Default: 20

purgethreshold

Number

Defined in yui/js/yui.js:1650

The number of dynamic <script> nodes to insert by default before automatically removing them when loading scripts.

This applies only to script nodes because removing the node will not make the evaluated script unavailable. Dynamic CSS nodes are not auto purged, because removing a linked style sheet will also remove the style definitions.

Default: 20

requireRegistration

Boolean

Defined in yui/js/yui.js:1979

Available since 3.3.0

If true, Loader will expect all loaded scripts to be first-class YUI modules that register themselves with the YUI global, and will trigger a failure if a loaded script does not register a YUI module.

Default: false

root

String

Defined in yui/js/yui.js:1685

Root path to prepend to each module path when creating a combo-handled request.

This is updated for each YUI release to point to a specific version of the library; for example: "3.8.0/build/".

skin

Object

Defined in yui/js/yui.js:1717

Skin configuration and customizations.

Sub-properties:

  • [defaultSkin='sam'] String optional

    Default skin name. This skin will be applied automatically to skinnable components if not overridden by a component-specific skin name.

  • [base='assets/skins/'] String optional

    Default base path for a skin, relative to Loader's base path.

  • [overrides] Object optional

    Component-specific skin name overrides. Specify a component name as the key and, as the value, a string or array of strings for a skin or skins that should be loaded for that component instead of the defaultSkin.

throwFail

Boolean

Defined in yui/js/yui.js:1570

If true, Y.error() will generate or re-throw a JavaScript error. Otherwise, errors are merely logged silently.

Default: true

timeout

Number

Defined in yui/js/yui.js:1786

Timeout in milliseconds before a dynamic JS or CSS request will be considered a failure. If not set, no timeout will be enforced.

useBrowserConsole

Boolean

Defined in yui/js/yui.js:1535

Log messages to the browser console if debug is true and the browser has a supported console.

Default: true

useHistoryHTML5

Boolean

Provided by the history-html5 module.

Defined in history/js/history-html5.js:148

Available since 3.2.0

If true, the Y.History alias will always point to Y.HistoryHTML5 when the history-html5 module is loaded, even if the current browser doesn't support HTML5 history.

If false, the Y.History alias will always point to Y.HistoryHash when the history-hash module is loaded, even if the current browser supports HTML5 history.

If neither true nor false, the Y.History alias will point to the best available history adapter that the browser supports. This is the default behavior.

useNativeES5

Boolean

Defined in yui/js/yui.js:1998

Available since 3.5.0

Whether or not YUI should use native ES5 functionality when available for features like Y.Array.each(), Y.Object(), etc.

When false, YUI will always use its own fallback implementations instead of relying on ES5 functionality, even when ES5 functionality is available.

Default: true

win

Window

Defined in yui/js/yui.js:1587

The browser window or frame that this YUI instance should operate in.

When running in Node.js, this property is undefined, since there is no window object. Use global to get a reference to the global object that will work in both browsers and Node.js.

windowResizeDelay

Number

Defined in yui/js/yui.js:1662

Delay in milliseconds to wait after a window resize event before firing the event. If another resize event occurs before this delay has elapsed, the delay will start over to ensure that resize events are throttled.

Default: 40

yui2

String

Defined in yui/js/yui.js:1923

Available since 3.1.0

Default YUI 2 version used to build YUI 2 module urls.

This is used for intrinsic YUI 2 support via the 2in3 project. Also see the 2in3 config for pulling different revisions of the wrapped YUI 2 modules.

Default: "2.9.0"