webui-aria2/js/libs/dijit/_base/manager.js.uncompressed.js
2012-05-01 19:52:07 +08:00

78 lines
2.2 KiB
JavaScript

//>>built
define("dijit/_base/manager", [
"dojo/_base/array",
"dojo/_base/config", // defaultDuration
"../registry",
".." // for setting exports to dijit namespace
], function(array, config, registry, dijit){
// module:
// dijit/_base/manager
// summary:
// Shim to methods on registry, plus a few other declarations.
// New code should access dijit/registry directly when possible.
/*=====
dijit.byId = function(id){
// summary:
// Returns a widget by it's id, or if passed a widget, no-op (like dom.byId())
// id: String|dijit._Widget
return registry.byId(id); // dijit._Widget
};
dijit.getUniqueId = function(widgetType){
// summary:
// Generates a unique id for a given widgetType
// widgetType: String
return registry.getUniqueId(widgetType); // String
};
dijit.findWidgets = function(root){
// summary:
// Search subtree under root returning widgets found.
// Doesn't search for nested widgets (ie, widgets inside other widgets).
// root: DOMNode
return registry.findWidgets(root);
};
dijit._destroyAll = function(){
// summary:
// Code to destroy all widgets and do other cleanup on page unload
return registry._destroyAll();
};
dijit.byNode = function(node){
// summary:
// Returns the widget corresponding to the given DOMNode
// node: DOMNode
return registry.byNode(node); // dijit._Widget
};
dijit.getEnclosingWidget = function(node){
// summary:
// Returns the widget whose DOM tree contains the specified DOMNode, or null if
// the node is not contained within the DOM tree of any widget
// node: DOMNode
return registry.getEnclosingWidget(node);
};
=====*/
array.forEach(["byId", "getUniqueId", "findWidgets", "_destroyAll", "byNode", "getEnclosingWidget"], function(name){
dijit[name] = registry[name];
});
/*=====
dojo.mixin(dijit, {
// defaultDuration: Integer
// The default fx.animation speed (in ms) to use for all Dijit
// transitional fx.animations, unless otherwise specified
// on a per-instance basis. Defaults to 200, overrided by
// `djConfig.defaultDuration`
defaultDuration: 200
});
=====*/
dijit.defaultDuration = config["defaultDuration"] || 200;
return dijit;
});