-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathCore.Singleton.js
More file actions
31 lines (29 loc) · 852 Bytes
/
Core.Singleton.js
File metadata and controls
31 lines (29 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*globals Core*/
(function () {
var coreSingleton = function () {
var singletons = {},
registerSingleton = function (singletonId, singleton) {
singletons[singletonId] = singleton;
},
getSingleton = function (singletonId) {
return singletons[singletonId];
},
singletonIsActive = function(singletonId) {
return getSingleton(singletonId) !== undefined;
};
return {
registerSingleton: registerSingleton,
getSingleton: getSingleton,
singletonIsActive: singletonIsActive
};
};
if (typeof define === "function" && define.amd) {
define("Core.Singleton", ["Core"], function (core) {
core.Singleton = coreSingleton();
return core.Singleton;
});
}
else {
Core.Singleton = coreSingleton();
}
})();