pict 1.0.208 → 1.0.209
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/pict.compatible.js +15 -1
- package/dist/pict.compatible.min.js +2 -2
- package/dist/pict.compatible.min.js.map +1 -1
- package/dist/pict.js +15 -1
- package/dist/pict.min.js +2 -2
- package/dist/pict.min.js.map +1 -1
- package/package.json +2 -2
- package/source/Pict.js +24 -0
- package/test/Pict_provider_tests.js +38 -0
- package/types/Pict.d.ts +16 -0
- package/types/Pict.d.ts.map +1 -1
package/dist/pict.compatible.js
CHANGED
|
@@ -782,7 +782,7 @@ this.serviceTypes.push(pServiceType);}// Using the static member of the class is
|
|
|
782
782
|
if(typeof pServiceClass=='function'&&pServiceClass.isFableService){// Add the class to the list of classes
|
|
783
783
|
this.serviceClasses[pServiceType]=pServiceClass;}else{// Add the base class to the list of classes
|
|
784
784
|
this.log.error("Attempted to add service type [".concat(pServiceType,"] with an invalid class. Using base service class, which will not crash but won't provide meaningful services."));this.serviceClasses[pServiceType]=libFableServiceBase;}return this.serviceClasses[pServiceType];}},{key:"addServiceTypeIfNotExists",value:function addServiceTypeIfNotExists(pServiceType,pServiceClass){if(!(pServiceType in this.servicesMap)){return this.addServiceType(pServiceType,pServiceClass);}else{return this.serviceClasses[pServiceType];}}// This is for the services that are meant to run mostly single-instance so need a default at initialization
|
|
785
|
-
},{key:"addAndInstantiateServiceType",value:function addAndInstantiateServiceType(pServiceType,pServiceClass){this.addServiceType(pServiceType,pServiceClass);return this.instantiateServiceProvider(pServiceType,{},"".concat(pServiceType,"-Default"));}},{key:"addAndInstantiateServiceTypeIfNotExists",value:function addAndInstantiateServiceTypeIfNotExists(pServiceType,pServiceClass){this.addServiceTypeIfNotExists(pServiceType,pServiceClass);if(!(pServiceType in this.servicesMap)){return this.instantiateServiceProvider(pServiceType,{},"".concat(pServiceType,"-Default"));}else{return this.
|
|
785
|
+
},{key:"addAndInstantiateServiceType",value:function addAndInstantiateServiceType(pServiceType,pServiceClass){this.addServiceType(pServiceType,pServiceClass);return this.instantiateServiceProvider(pServiceType,{},"".concat(pServiceType,"-Default"));}},{key:"addAndInstantiateServiceTypeIfNotExists",value:function addAndInstantiateServiceTypeIfNotExists(pServiceType,pServiceClass){this.addServiceTypeIfNotExists(pServiceType,pServiceClass);if(!(pServiceType in this.servicesMap)||!(pServiceType in this.fable)){return this.instantiateServiceProvider(pServiceType,{},"".concat(pServiceType,"-Default"));}else{return this[pServiceType];}}},{key:"addAndInstantiateSingletonService",value:function addAndInstantiateSingletonService(pServiceType,pOptions,pServiceClass){this.addServiceTypeIfNotExists(pServiceType,pServiceClass);if(!(pServiceType in this.servicesMap)||!(pServiceType in this.fable)){return this.instantiateServiceProvider(pServiceType,{},"".concat(pServiceType,"-Default"));}else{return this[pServiceType];}}// Some services expect to be overloaded / customized class.
|
|
786
786
|
},{key:"instantiateServiceProviderFromPrototype",value:function instantiateServiceProviderFromPrototype(pServiceType,pOptions,pCustomServiceHash,pServicePrototype){// Instantiate the service
|
|
787
787
|
var tmpService=new pServicePrototype(this,pOptions,pCustomServiceHash);if(this.extraServiceInitialization){tmpService=this.extraServiceInitialization(tmpService);}// Add the service to the service map
|
|
788
788
|
this.servicesMap[pServiceType][tmpService.Hash]=tmpService;// If this is the first service of this type, make it the default
|
|
@@ -4522,6 +4522,20 @@ var tmpManifestKey=tmpManifestKeys[i];this.instantiateServiceProvider('Manifest'
|
|
|
4522
4522
|
* @return {any} The view instance.
|
|
4523
4523
|
*/},{key:"addView",value:function addView(pViewHash,pOptions,pViewPrototype){var tmpOptions=_typeof(pOptions)=='object'?pOptions:{};var tmpViewHash=typeof pViewHash=='string'?pViewHash:this.fable.getUUID();if(this.LogControlFlow){if(this.LogNoisiness>1){this.log.info("PICT-ControlFlow addView [".concat(tmpViewHash,"]:"),{Options:tmpOptions});}else{this.log.info("PICT-ControlFlow addView [".concat(tmpViewHash,"]"));}}if(typeof pViewPrototype!='undefined'){// If the prototype has a default_configuration, it will be merged with options.
|
|
4524
4524
|
if('default_configuration'in pViewPrototype){tmpOptions=this.fable.Utility.extend({},JSON.parse(JSON.stringify(pViewPrototype.default_configuration)),tmpOptions);}return this.instantiateServiceProviderFromPrototype('PictView',tmpOptions,tmpViewHash,pViewPrototype);}else{return this.instantiateServiceProvider('PictView',tmpOptions,tmpViewHash);}}/**
|
|
4525
|
+
* Add a provider unless one already exists, then return that one.
|
|
4526
|
+
*
|
|
4527
|
+
* Just passing an options will construct one for us.
|
|
4528
|
+
* Passing a hash will set the hash.
|
|
4529
|
+
* Passing a prototype will use that!
|
|
4530
|
+
*
|
|
4531
|
+
* @param {String} pProviderHash - The hash of the provider.
|
|
4532
|
+
* @param {Object<String, any>} [pOptions] - The options for the provider.
|
|
4533
|
+
* @param {any} [pProviderPrototype] - The prototype for the provider.
|
|
4534
|
+
*
|
|
4535
|
+
* FIXME: refer to PictProvider here once it has a type definition
|
|
4536
|
+
*
|
|
4537
|
+
* @return {any} The provider instance.
|
|
4538
|
+
*/},{key:"addProviderSingleton",value:function addProviderSingleton(pProviderHash,pOptions,pProviderPrototype){if(pProviderHash in this.providers){return this.providers[pProviderHash];}return this.addProvider(pProviderHash,pOptions,pProviderPrototype);}/**
|
|
4525
4539
|
* Just passing an options will construct one for us.
|
|
4526
4540
|
* Passing a hash will set the hash.
|
|
4527
4541
|
* Passing a prototype will use that!
|