flymis/WebRoot/dojojs/src/ns.js
(开头部分) 5KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/*
Copyright (c) 2004-2006, The Dojo Foundation
All Rights Reserved.
Licensed under the Academic Free License version 2.1 or above OR the
modified BSD license. For more information on Dojo licensing, see:
http://dojotoolkit.org/community/licensing.shtml
*/
dojo.provide("dojo.ns");
dojo.ns = {
// summary: private object that implements widget namespace management
namespaces: {},
failed: {},
loading: {},
loaded: {},
register: function(/*String*/name, /*String*/module, /*Function?*/resolver, /*Boolean?*/noOverride){
// summary: creates and registers a dojo.ns.Ns object
if(!noOverride || !this.namespaces[name]){
this.namespaces[name] = new dojo.ns.Ns(name, module, resolver);
}
},
allow: function(/*String*/name){
// summary: Returns false if 'name' is filtered by configuration or has failed to load, true otherwise
if(this.failed[name]){return false;} // Boolean
if((djConfig.excludeNamespace)&&(dojo.lang.inArray(djConfig.excludeNamespace, name))){return false;} // Boolean
// If the namespace is "dojo", or the user has not specified allowed namespaces return true.
// Otherwise, if the user has specifically allowed this namespace, return true, otherwise false.
return((name==this.dojo)||(!djConfig.includeNamespace)||(dojo.lang.inArray(djConfig.includeNamespace, name))); // Boolean
},
get: function(/*String*/name){
// summary
// Return Ns object registered to 'name', if any
return this.namespaces[name]; // Ns
},
require: function(/*String*/name){
// summary
// Try to ensure that 'name' is registered, loading a namespace manifest if necessary
var ns = this.namespaces[name];
if((ns)&&(this.loaded[name])){return ns;} // Ns
if(!this.allow(name)){return false;} // Boolean
if(this.loading[name]){
// FIXME: do we really ever have re-entrancy situation? this would appear to be really bad
// original code did not throw an exception, although that seems the only course
// adding debug output here to track if this occurs.
dojo.debug('dojo.namespace.require: re-entrant request to load namespace "' + name + '" must fail.');
return false; // Boolean
}
// workaround so we don't break the build system
var req = dojo.require;
this.loading[name] = true;
try {
//dojo namespace file is always in the Dojo namespaces folder, not any custom folder
if(name=="dojo"){
req("dojo.namespaces.dojo");
}else{
// if no registered module prefix, use ../<name> by convention
if(!dojo.hostenv.moduleHasPrefix(name)){
后面还有 82 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。