source: Dev/branches/rest-dojo-ui/client/dijit/_base/manager.js @ 256

Last change on this file since 256 was 256, checked in by hendrikvanantwerpen, 13 years ago

Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).

File size: 2.1 KB
Line 
1define([
2        "dojo/_base/array",
3        "dojo/_base/config", // defaultDuration
4        "../registry",
5        ".."    // for setting exports to dijit namespace
6], function(array, config, registry, dijit){
7
8        // module:
9        //              dijit/_base/manager
10        // summary:
11        //              Shim to methods on registry, plus a few other declarations.
12        //              New code should access dijit/registry directly when possible.
13
14        /*=====
15        dijit.byId = function(id){
16                // summary:
17                //              Returns a widget by it's id, or if passed a widget, no-op (like dom.byId())
18                // id: String|dijit._Widget
19                return registry.byId(id); // dijit._Widget
20        };
21
22        dijit.getUniqueId = function(widgetType){
23                // summary:
24                //              Generates a unique id for a given widgetType
25                // widgetType: String
26                return registry.getUniqueId(widgetType); // String
27        };
28
29        dijit.findWidgets = function(root){
30                // summary:
31                //              Search subtree under root returning widgets found.
32                //              Doesn't search for nested widgets (ie, widgets inside other widgets).
33                // root: DOMNode
34                return registry.findWidgets(root);
35        };
36
37        dijit._destroyAll = function(){
38                // summary:
39                //              Code to destroy all widgets and do other cleanup on page unload
40
41                return registry._destroyAll();
42        };
43
44        dijit.byNode = function(node){
45                // summary:
46                //              Returns the widget corresponding to the given DOMNode
47                // node: DOMNode
48                return registry.byNode(node); // dijit._Widget
49        };
50
51        dijit.getEnclosingWidget = function(node){
52                // summary:
53                //              Returns the widget whose DOM tree contains the specified DOMNode, or null if
54                //              the node is not contained within the DOM tree of any widget
55                // node: DOMNode
56                return registry.getEnclosingWidget(node);
57        };
58        =====*/
59        array.forEach(["byId", "getUniqueId", "findWidgets", "_destroyAll", "byNode", "getEnclosingWidget"], function(name){
60                dijit[name] = registry[name];
61        });
62
63        /*=====
64        dojo.mixin(dijit, {
65                // defaultDuration: Integer
66                //              The default fx.animation speed (in ms) to use for all Dijit
67                //              transitional fx.animations, unless otherwise specified
68                //              on a per-instance basis. Defaults to 200, overrided by
69                //              `djConfig.defaultDuration`
70                defaultDuration: 200
71        });
72        =====*/
73        dijit.defaultDuration = config["defaultDuration"] || 200;
74
75        return dijit;
76});
Note: See TracBrowser for help on using the repository browser.