@common-stack/client-core
Advanced tools
Comparing version 4.0.1-alpha.6 to 4.0.1-alpha.7
@@ -75,3 +75,3 @@ import*as React from'react';import {merge,without,union,castArray}from'lodash-es';import {consolidatedResolvers}from'../utils/resolversUtils.js';import {ScopedContainer}from'./ScopedContainer.js';/* eslint-disable no-underscore-dangle */ | ||
try { | ||
if (!this.isContainerLoaded) { | ||
if (!ScopedContainer.isExist(scopeId)) { | ||
this.createContainers(options, scopeId); | ||
@@ -78,0 +78,0 @@ } |
@@ -37,2 +37,8 @@ import { Container, interfaces } from 'inversify'; | ||
/** | ||
* Checks if a container exists for the specified scope. | ||
* @param scopeId Any string to identify the scope (e.g. current request ID). | ||
* @returns True if a container exists for the specified scope, false otherwise. | ||
*/ | ||
static isExist(scopeId?: string): boolean; | ||
/** | ||
* Unbinds the @see Container (i.e. container.unbindAll()) and removes | ||
@@ -39,0 +45,0 @@ * it from the cache. |
@@ -21,2 +21,10 @@ import {Container}from'inversify';/* eslint-disable no-underscore-dangle */ | ||
/** | ||
* Checks if a container exists for the specified scope. | ||
* @param scopeId Any string to identify the scope (e.g. current request ID). | ||
* @returns True if a container exists for the specified scope, false otherwise. | ||
*/ | ||
static isExist(scopeId = DEFAULT_SCOPE_ID) { | ||
return !!this._containerInstances[scopeId]; | ||
} | ||
/** | ||
* Unbinds the @see Container (i.e. container.unbindAll()) and removes | ||
@@ -76,2 +84,17 @@ * it from the cache. | ||
ScopedContainer._dependencyRegistrations = []; | ||
ScopedContainer._containerInstances = {};export{ScopedContainer};//# sourceMappingURL=ScopedContainer.js.map | ||
ScopedContainer._containerInstances = {}; | ||
/** | ||
* A function to register global dependencies. | ||
* This creates a global container instance, which enables truly | ||
* singleton instances when using a scoped container. All scoped | ||
* containers reference the global container as parent. | ||
* | ||
* @example | ||
* ScopedContainer.registerGlobalDependencies((container) => { | ||
* container | ||
* .bind<SomeSingletonDep>(TOKENS.SomeSingletonDep) | ||
* .to(SomeSingletonDep) | ||
* .inSingletonScope(); | ||
* })(); | ||
*/ | ||
ScopedContainer.registerGlobalDependencies = () => { };export{ScopedContainer};//# sourceMappingURL=ScopedContainer.js.map |
{ | ||
"name": "@common-stack/client-core", | ||
"version": "4.0.1-alpha.6", | ||
"version": "4.0.1-alpha.7", | ||
"description": "common core for higher packages to depend on", | ||
@@ -36,3 +36,3 @@ "license": "ISC", | ||
}, | ||
"gitHead": "90624ca5bdda49d2caf49316ec34529d3789e382" | ||
"gitHead": "a35fc04af2f217986d5e271ed81e24514fbd2f1b" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51905
839