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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fable",
3
- "version": "3.0.47",
3
+ "version": "3.0.48",
4
4
  "description": "An entity behavior management and API bundling library.",
5
5
  "main": "source/Fable.js",
6
6
  "scripts": {
@@ -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
  }