##// END OF EJS Templates
working on fluent container configuration
working on fluent container configuration

File last commit:

r120:1b124b65514a ioc ts support
r125:a19ad0acfd39 ioc ts support
Show More
FactoryServiceDescriptor.ts
21 lines | 772 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
improved interfaces and more tight type checking
r120 export interface FactoryServiceDescriptorParams<S extends object, T, P extends any[]> extends ServiceDescriptorParams<S, T, P> {
cin
corrected code to support ts strict mode...
r115 factory: (...args: P) => T;
cin
changed the project structure
r49 }
cin
improved interfaces and more tight type checking
r120 export class FactoryServiceDescriptor<S extends object, T, P extends any[]> extends ServiceDescriptor<S, T, P> {
cin
corrected code to support ts strict mode...
r115 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);
}
}
}