##// END OF EJS Templates
Added tag v1.3.2 for changeset 32db28d9ca07
Added tag v1.3.2 for changeset 32db28d9ca07

File last commit:

r65:0c74a0572161 v1.2.13 default
r104:da978c4e697c default
Show More
FactoryServiceDescriptor.ts
23 lines | 753 B | video/mp2t | TypeScriptLexer
/ src / main / ts / di / FactoryServiceDescriptor.ts
import { ServiceDescriptor, ServiceDescriptorParams } from "./ServiceDescriptor";
import { Factory } from "../interfaces";
import { argumentNotNull, oid } from "../safe";
import { ActivationType } from "./interfaces";
export interface FactoryServiceDescriptorParams extends ServiceDescriptorParams {
factory: Factory;
}
export class FactoryServiceDescriptor extends ServiceDescriptor {
constructor(opts: FactoryServiceDescriptorParams) {
super(opts);
argumentNotNull(opts && opts.factory, "opts.factory");
// bind to null
this._factory = (...args) => opts.factory.apply(null, args);
if (opts.activation === ActivationType.Singleton) {
this._cacheId = oid(opts.factory);
}
}
}