fable 3.0.63 → 3.0.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fable",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.65",
|
|
4
4
|
"description": "An entity behavior management and API bundling library.",
|
|
5
5
|
"main": "source/Fable.js",
|
|
6
6
|
"scripts": {
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"cookie": "^0.5.0",
|
|
59
59
|
"data-arithmatic": "^1.0.7",
|
|
60
60
|
"fable-log": "^3.0.10",
|
|
61
|
-
"fable-serviceproviderbase": "^3.0.
|
|
61
|
+
"fable-serviceproviderbase": "^3.0.7",
|
|
62
62
|
"fable-settings": "^3.0.6",
|
|
63
63
|
"fable-uuid": "^3.0.5",
|
|
64
64
|
"manyfest": "^1.0.24",
|
|
@@ -30,11 +30,19 @@ class FableService extends libFableServiceBase.CoreServiceProviderBase
|
|
|
30
30
|
|
|
31
31
|
addServiceType(pServiceType, pServiceClass)
|
|
32
32
|
{
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
if (this.serviceMap.hasOwnProperty(pServiceType))
|
|
34
|
+
{
|
|
35
|
+
// TODO: Check if any services are running?
|
|
36
|
+
this.fable.log.warn(`Adding a service type [${pServiceType}] that already exists.`);
|
|
37
|
+
}
|
|
38
|
+
else
|
|
39
|
+
{
|
|
40
|
+
// Add the container for instantiated services to go in
|
|
41
|
+
this.serviceMap[pServiceType] = {};
|
|
35
42
|
|
|
36
|
-
|
|
37
|
-
|
|
43
|
+
// Add the type to the list of types
|
|
44
|
+
this.serviceTypes.push(pServiceType);
|
|
45
|
+
}
|
|
38
46
|
|
|
39
47
|
// Using the static member of the class is a much more reliable way to check if it is a service class than instanceof
|
|
40
48
|
if ((typeof(pServiceClass) == 'function') && (pServiceClass.isFableService))
|
|
@@ -54,7 +62,7 @@ class FableService extends libFableServiceBase.CoreServiceProviderBase
|
|
|
54
62
|
addAndInstantiateServiceType(pServiceType, pServiceClass)
|
|
55
63
|
{
|
|
56
64
|
this.addServiceType(pServiceType, pServiceClass);
|
|
57
|
-
this.instantiateServiceProvider(pServiceType, {}, `${pServiceType}-Default`);
|
|
65
|
+
return this.instantiateServiceProvider(pServiceType, {}, `${pServiceType}-Default`);
|
|
58
66
|
}
|
|
59
67
|
|
|
60
68
|
// Some services expect to be overloaded / customized class.
|
|
@@ -123,7 +131,7 @@ class FableService extends libFableServiceBase.CoreServiceProviderBase
|
|
|
123
131
|
{
|
|
124
132
|
// If the core service hasn't registered itself yet, create the service container for it.
|
|
125
133
|
// This means you couldn't register another with this type unless it was later registered with a constructor class.
|
|
126
|
-
this.
|
|
134
|
+
this.serviceMap[tmpServiceType] = {};
|
|
127
135
|
}
|
|
128
136
|
// Add the service to the service map
|
|
129
137
|
this.serviceMap[tmpServiceType][tmpServiceHash] = pServiceInstance;
|
package/source/Fable.js
CHANGED
|
@@ -82,9 +82,9 @@ class Fable
|
|
|
82
82
|
return this._coreServices.ServiceManager.services;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
get
|
|
85
|
+
get serviceMap()
|
|
86
86
|
{
|
|
87
|
-
return this._coreServices.ServiceManager.
|
|
87
|
+
return this._coreServices.ServiceManager.serviceMap;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
getUUID()
|
|
@@ -90,7 +90,7 @@ suite
|
|
|
90
90
|
testFable.serviceManager.addServiceType('SimpleService');
|
|
91
91
|
testFable.serviceManager.instantiateServiceProvider('SimpleService', { SomeOption: true }, 'SimpleService-123');
|
|
92
92
|
|
|
93
|
-
Expect(testFable.serviceManager.
|
|
93
|
+
Expect(testFable.serviceManager.serviceMap['SimpleService']['SimpleService-123']).to.be.an('object');
|
|
94
94
|
}
|
|
95
95
|
);
|
|
96
96
|
test
|
|
@@ -121,7 +121,7 @@ suite
|
|
|
121
121
|
testFable.serviceManager.addServiceType('SimpleService', SimpleService);
|
|
122
122
|
testFable.serviceManager.instantiateServiceProvider('SimpleService', { SomeOption: true }, 'SimpleService-123');
|
|
123
123
|
|
|
124
|
-
Expect(testFable.serviceManager.
|
|
124
|
+
Expect(testFable.serviceManager.serviceMap['SimpleService']['SimpleService-123']).to.be.an('object');
|
|
125
125
|
|
|
126
126
|
Expect(testFable.serviceManager.services['SimpleService']).to.be.an('object');
|
|
127
127
|
|
|
@@ -141,9 +141,9 @@ suite
|
|
|
141
141
|
|
|
142
142
|
testFable.serviceManager.instantiateServiceProvider('SimpleService', { SomeOption: true }, 'SimpleService-13');
|
|
143
143
|
|
|
144
|
-
testFable.serviceManager.
|
|
144
|
+
testFable.serviceManager.serviceMap['SimpleService']['SimpleService-13'].doSomething();
|
|
145
145
|
|
|
146
|
-
Expect(testFable.serviceManager.
|
|
146
|
+
Expect(testFable.serviceManager.serviceMap['SimpleService']['SimpleService-13']).to.be.an('object');
|
|
147
147
|
}
|
|
148
148
|
);
|
|
149
149
|
|