Created
April 4, 2013 16:49
-
-
Save razum2um/5312004 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (global) { | |
"use strict"; | |
var $ = global.jQuery, | |
module = YOUR_NAMESPACE.namespace('other.module'); | |
(function () { | |
function hidden_function() { | |
do_something(); | |
return; | |
} | |
function public_function() { | |
hidden_function(); | |
return; | |
} | |
module.public_function = public_function; | |
}()); | |
}(this)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (global) { | |
"use strict"; | |
// Глобальное пространство имен приложения | |
var YOUR_NAMESPACE = global.YOUR_NAMESPACE || {}; | |
// Инициализация пространства имен | |
YOUR_NAMESPACE.namespace = function (ns_string) { | |
var parts = ns_string.split('.'), | |
parent = YOUR_NAMESPACE, | |
i; | |
if (parts[0] === ' YOUR_NAMESPACE') { | |
parts = parts.slice(1); | |
} | |
for (i = 0; i < parts.length; i += 1) { | |
if (parent[parts[i]] === undefined) { | |
parent[parts[i]] = {}; | |
} | |
parent = parent[parts[i]]; | |
} | |
return parent; | |
}; | |
global.YOUR_NAMESPACE = YOUR_NAMESPACE; | |
}(this)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment