##// END OF EJS Templates
configuration draft-1
configuration draft-1

File last commit:

r118:6738ac4c3072 ioc ts support
r119:86e3aa3c3eea ioc ts support
Show More
FactoryServiceDescriptor.ts
21 lines | 742 B | video/mp2t | TypeScriptLexer
/ src / main / ts / di / FactoryServiceDescriptor.ts
cin
changed the project structure
r49 import { ServiceDescriptor, ServiceDescriptorParams } from "./ServiceDescriptor";
import { argumentNotNull, oid } from "../safe";
cin
corrected code to support ts strict mode...
r115 export interface FactoryServiceDescriptorParams<S, T, P extends any[]> extends ServiceDescriptorParams<S, T, P> {
factory: (...args: P) => T;
cin
changed the project structure
r49 }
cin
corrected code to support ts strict mode...
r115 export class FactoryServiceDescriptor<S, T, P extends any[]> extends ServiceDescriptor<S, T, P> {
constructor(opts: FactoryServiceDescriptorParams<S, T, P>) {
cin
changed the project structure
r49 super(opts);
argumentNotNull(opts && opts.factory, "opts.factory");
// bind to null
cin
corrected code to support ts strict mode...
r115 this._factory = (...args) => opts.factory.apply(null, args as any);
cin
changed the project structure
r49
cin
configuration interfaces moved to di/Configuration module...
r118 if (opts.activation === "singleton") {
cin
changed the project structure
r49 this._cacheId = oid(opts.factory);
}
}
}