@hashgraph/solo
Version:
An opinionated CLI tool to deploy and manage private Hedera Networks.
23 lines • 673 B
JavaScript
// SPDX-License-Identifier: Apache-2.0
export class BeanFactorySupplier {
token;
factory;
singleton;
cachedInstance;
constructor(token, factory, singleton = true) {
this.token = token;
this.factory = factory;
this.singleton = singleton;
}
register(container) {
container.register(this.token, {
useFactory: (c) => {
if (this.singleton && !this.cachedInstance) {
this.cachedInstance = this.factory(c);
}
return this.cachedInstance ?? this.factory(c);
},
});
}
}
//# sourceMappingURL=bean-factory-supplier.js.map