fable 3.0.123 → 3.0.124
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
package/source/Fable.js
CHANGED
|
@@ -115,7 +115,7 @@ class Fable extends libFableServiceBase.CoreServiceProviderBase
|
|
|
115
115
|
if (this.servicesMap.hasOwnProperty(pServiceType))
|
|
116
116
|
{
|
|
117
117
|
// TODO: Check if any services are running?
|
|
118
|
-
this.log.warn(`Adding a service type [${pServiceType}] that already exists.`);
|
|
118
|
+
this.log.warn(`Adding a service type [${pServiceType}] that already exists. This will change the default class prototype for this service.`);
|
|
119
119
|
}
|
|
120
120
|
else
|
|
121
121
|
{
|
|
@@ -138,6 +138,20 @@ class Fable extends libFableServiceBase.CoreServiceProviderBase
|
|
|
138
138
|
this.log.error(`Attempted to add service type [${pServiceType}] with an invalid class. Using base service class, which will not crash but won't provide meaningful services.`);
|
|
139
139
|
this.serviceClasses[pServiceType] = libFableServiceBase;
|
|
140
140
|
}
|
|
141
|
+
|
|
142
|
+
return this.serviceClasses[pServiceType];
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
addServiceTypeIfNotExists(pServiceType, pServiceClass)
|
|
146
|
+
{
|
|
147
|
+
if (!this.servicesMap.hasOwnProperty(pServiceType))
|
|
148
|
+
{
|
|
149
|
+
return this.addServiceType(pServiceType, pServiceClass);
|
|
150
|
+
}
|
|
151
|
+
else
|
|
152
|
+
{
|
|
153
|
+
return this.serviceClasses[pServiceType];
|
|
154
|
+
}
|
|
141
155
|
}
|
|
142
156
|
|
|
143
157
|
// This is for the services that are meant to run mostly single-instance so need a default at initialization
|
|
@@ -187,6 +201,18 @@ class Fable extends libFableServiceBase.CoreServiceProviderBase
|
|
|
187
201
|
return tmpService;
|
|
188
202
|
}
|
|
189
203
|
|
|
204
|
+
instantiateServiceProviderIfNotExists(pServiceType, pOptions, pCustomServiceHash)
|
|
205
|
+
{
|
|
206
|
+
if (this.services.hasOwnProperty(pServiceType))
|
|
207
|
+
{
|
|
208
|
+
return this.services[pServiceType];
|
|
209
|
+
}
|
|
210
|
+
else
|
|
211
|
+
{
|
|
212
|
+
return this.instantiateServiceProvider(pServiceType, pOptions, pCustomServiceHash);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
190
216
|
// Create a service provider but don't register it to live forever in fable.services
|
|
191
217
|
instantiateServiceProviderWithoutRegistration(pServiceType, pOptions, pCustomServiceHash)
|
|
192
218
|
{
|