forked from fanruan/fineui
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
685 B
31 lines
685 B
/** |
|
* 共享池 |
|
* @type {{Shared: {}}} |
|
*/ |
|
|
|
(function () { |
|
var _Shared = {}; |
|
BI.SharingPool = { |
|
_Shared: _Shared, |
|
put: function (name, shared) { |
|
_Shared[name] = shared; |
|
}, |
|
|
|
cat: function () { |
|
var args = Array.prototype.slice.call(arguments, 0), |
|
copy = _Shared; |
|
for (var i = 0; i < args.length; i++) { |
|
copy = copy && copy[args[i]]; |
|
} |
|
return copy; |
|
}, |
|
|
|
get: function () { |
|
return BI.deepClone(this.cat.apply(this, arguments)); |
|
}, |
|
|
|
remove: function (key) { |
|
delete _Shared[key]; |
|
} |
|
}; |
|
})(); |