fable 3.0.47 → 3.0.48
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/dist/fable.compatible.js +5 -1
- package/dist/fable.compatible.min.js +1 -1
- package/dist/fable.compatible.min.js.map +1 -1
- package/dist/fable.js +5 -1
- package/dist/fable.min.js +1 -1
- package/dist/fable.min.js.map +1 -1
- package/package.json +1 -1
- package/source/Fable-ServiceManager.js +19 -0
- package/test/FableServiceManager_tests.js +3 -0
package/package.json
CHANGED
|
@@ -54,6 +54,25 @@ class FableService extends libFableServiceBase.CoreServiceProviderBase
|
|
|
54
54
|
this.instantiateServiceProvider(pServiceType, {}, `${pServiceType}-Default`);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
// Some servicds expect to be overloaded / customized class.
|
|
58
|
+
instantiateServiceProviderFromPrototype(pServiceType, pOptions, pCustomServiceHash, pServicePrototype)
|
|
59
|
+
{
|
|
60
|
+
// Instantiate the service
|
|
61
|
+
let tmpService = new pServicePrototype(this.fable, pOptions, pCustomServiceHash);
|
|
62
|
+
|
|
63
|
+
// Add the service to the service map
|
|
64
|
+
this.services[pServiceType][tmpService.Hash] = tmpService;
|
|
65
|
+
|
|
66
|
+
// If this is the first service of this type, make it the default
|
|
67
|
+
if (!this.defaultServices.hasOwnProperty(pServiceType))
|
|
68
|
+
{
|
|
69
|
+
this.setDefaultServiceInstantiation(pServiceType, tmpService.Hash)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return tmpService;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
57
76
|
instantiateServiceProvider(pServiceType, pOptions, pCustomServiceHash)
|
|
58
77
|
{
|
|
59
78
|
// Instantiate the service
|
|
@@ -138,8 +138,11 @@ suite
|
|
|
138
138
|
testFable.serviceManager.addServiceType('SimpleService', SimpleService);
|
|
139
139
|
|
|
140
140
|
let tmpService = testFable.serviceManager.instantiateServiceProviderWithoutRegistration('SimpleService', {SomeOption: true}, 'SimpleService-99');
|
|
141
|
+
let tmpServiceFromPrototype = testFable.serviceManager.instantiateServiceProviderFromPrototype('SimpleService', {SomeOption: true}, 'SimpleService-100', SimpleService);
|
|
141
142
|
|
|
142
143
|
Expect(testFable.services.SimpleService['SimpleService-99']).to.be.an('undefined');
|
|
144
|
+
Expect(testFable.services.SimpleService['SimpleService-100']).to.be.an('object');
|
|
145
|
+
Expect(tmpServiceFromPrototype).to.be.an('object');
|
|
143
146
|
|
|
144
147
|
Expect(tmpService).to.be.an('object');
|
|
145
148
|
}
|