PageRenderTime 80ms CodeModel.GetById 71ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/Base/MVCUIHtmlHelper/MVCUIHtmlHelper.Web/Content/js/dhtmlx/dhtmlxGrid/codebase/calendar/YAHOO.js

#
JavaScript | 60 lines | 19 code | 14 blank | 27 comment | 5 complexity | 65f29b8250b1c1c773eeab7faf5e69d3 MD5 | raw file
 1/* Copyright (c) 2006 Yahoo! Inc. All rights reserved. */
 2
 3/**
 4 * @class The Yahoo global namespace
 5 */
 6var YAHOO = function() {
 7
 8    return {
 9
10        /**
11         * Yahoo presentation platform utils namespace
12         */
13        util: {},
14
15        /**
16         * Yahoo presentation platform widgets namespace
17         */
18        widget: {},
19
20        /**
21         * Yahoo presentation platform examples namespace
22         */
23        example: {},
24
25        /**
26         * Returns the namespace specified and creates it if it doesn't exist
27         *
28         * YAHOO.namespace("property.package");
29         * YAHOO.namespace("YAHOO.property.package");
30         *
31         * Either of the above would create YAHOO.property, then
32         * YAHOO.property.package
33         *
34         * @param  {String} sNameSpace String representation of the desired 
35         *                             namespace
36         * @return {Object}            A reference to the namespace object
37         */
38        namespace: function( sNameSpace ) {
39
40            if (!sNameSpace || !sNameSpace.length) {
41                return null;
42            }
43
44            var levels = sNameSpace.split(".");
45
46            var currentNS = YAHOO;
47
48            // YAHOO is implied, so it is ignored if it is included
49            for (var i=(levels[0] == "YAHOO") ? 1 : 0; i<levels.length; ++i) {
50                currentNS[levels[i]] = currentNS[levels[i]] || {};
51                currentNS = currentNS[levels[i]];
52            }
53
54            return currentNS;
55
56        }
57    };
58
59} ();
60