本文整理匯總了TypeScript中rr-tsdi.Injector類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Injector類的具體用法?TypeScript Injector怎麽用?TypeScript Injector使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Injector類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: beforeEach
beforeEach(() => {
const injector = new Injector();
injector.registerService(SIMPLE_MATH, SimpleMath);
injector.registerService(LIST_FACTORY, ListFactory);
listFactory = injector.get(LIST_FACTORY);
});
示例2: beforeEach
beforeEach(() => {
const injector = new Injector();
injector.registerService(SIMPLE_MATH, SimpleMath);
simpleMath = injector.get(SIMPLE_MATH);
list = new List<number>(simpleMath, SIZE_MAX);
});
示例3: beforeEach
beforeEach(() => {
const injector = new Injector();
injector.registerService(COMPLEX_DEPENDENCY_BAG, ComplexDependencyBag);
injector.registerService(SIMPLE_MATH, SimpleMath);
injector.registerValue(PRECISION_DIGITS, precisionDigits);
complexDependencyBag = injector.get(COMPLEX_DEPENDENCY_BAG);
complex = new Complex(complexDependencyBag, REAL, IMAGINARY);
});
示例4: beforeEach
beforeEach(() => {
const injector = new Injector();
injector.registerService(COMPLEX_DEPENDENCY_BAG, ComplexDependencyBag);
injector.registerValue(PRECISION_DIGITS, precisionDigits);
injector.registerService(SIMPLE_MATH, SimpleMath);
injector.registerService(COMPLEX_FACTORY, ComplexFactory);
injector.registerService(LIST_FACTORY, ListFactory);
injector.registerService(SIGNAL_FACTORY, SignalFactory);
injector.registerService(FOURIER_TRANSFORM, FftDitRecursive);
fft = injector.get(FOURIER_TRANSFORM);
signalFactory = injector.get(SIGNAL_FACTORY);
});
示例5: it
it('should properly provide all expected items', () => {
const injector = new Injector();
let commonModule: ICommonModule;
injector.registerService(LIST_FACTORY, ListFactory);
injector.registerService(SIMPLE_MATH, SimpleMath);
injector.registerService(COMMON_MODULE, CommonModule);
commonModule = injector.get(COMMON_MODULE);
expect(commonModule).toBeInstanceOf(CommonModule);
expect(commonModule.listFactory).toBeInstanceOf(ListFactory);
expect(commonModule.simpleMath).toBeInstanceOf(SimpleMath);
});
示例6: it
it('should properly provide all expected items', () => {
const injector = new Injector();
let complexDependencyBag: IComplexDependencyBag;
injector.registerService(SIMPLE_MATH, SimpleMath);
injector.registerValue(PRECISION_DIGITS, precisionDigits);
injector.registerService(COMPLEX_DEPENDENCY_BAG, ComplexDependencyBag);
complexDependencyBag = injector.get(COMPLEX_DEPENDENCY_BAG);
expect(complexDependencyBag).toBeInstanceOf(ComplexDependencyBag);
expect(complexDependencyBag.simpleMath).toBeInstanceOf(SimpleMath);
expect(complexDependencyBag.precisionDigits).toBe(precisionDigits);
expect(complexDependencyBag.epsilon).toBe(0.000001);
});
示例7: it
it('should properly provide all expected items', () => {
const injector = new Injector();
let dspModule: IDspModule;
injector.registerService(SIMPLE_MATH, SimpleMath);
injector.registerService(LIST_FACTORY, ListFactory);
injector.registerService(COMPLEX_DEPENDENCY_BAG, ComplexDependencyBag);
injector.registerValue(PRECISION_DIGITS, precisionDigits);
injector.registerService(SIGNAL_FACTORY, SignalFactory);
injector.registerService(COMPLEX_FACTORY, ComplexFactory);
injector.registerService(FOURIER_TRANSFORM, FftDitRecursive);
injector.registerService(DSP_MODULE, DspModule);
dspModule = injector.get(DSP_MODULE);
expect(dspModule).toBeInstanceOf(DspModule);
expect(dspModule.signalFactory).toBeInstanceOf(SignalFactory);
expect(dspModule.complexFactory).toBeInstanceOf(ComplexFactory);
expect(dspModule.fourierTransform).toBeInstanceOf(FftDitRecursive);
});
示例8: beforeEach
beforeEach(() => {
const injector = new Injector();
injector.registerService(SIMPLE_MATH, SimpleMath);
injector.registerService(COMPLEX_FACTORY, ComplexFactory);
injector.registerService(COMPLEX_DEPENDENCY_BAG, ComplexDependencyBag);
injector.registerValue(PRECISION_DIGITS, precisionDigits);
complexFactory = injector.get(COMPLEX_FACTORY);
});
示例9: beforeEach
beforeEach(() => {
const injector = new Injector();
injector.registerService(SIMPLE_MATH, SimpleMath);
simpleMath = injector.get(SIMPLE_MATH);
});
示例10: Injector
import { COMPLEX_DEPENDENCY_BAG, COMPLEX_FACTORY } from './dsp/complex/di-token';
import { DSP_MODULE } from './dsp/di-token';
import { FOURIER_TRANSFORM } from './dsp/fourier-transform/di-token';
import { SIGNAL_FACTORY } from './dsp/signal/di-token';
import { CommonModule } from './common/common-module';
import { ListFactory } from './common/list/list-factory';
import { SimpleMath } from './common/simple-math/simple-math';
import { ComplexDependencyBag } from './dsp/complex/complex-dependency-bag';
import { ComplexFactory } from './dsp/complex/complex-factory';
import { DspModule } from './dsp/dsp-module';
import { FftDitRecursive } from './dsp/fourier-transform/fft-dit-recursive/fft-dit-recursive';
import { SignalFactory } from './dsp/signal/signal-factory';
import { precisionDigits } from './settings';
const injector = new Injector();
injector.registerValue(PRECISION_DIGITS, precisionDigits);
injector.registerService(LIST_FACTORY, ListFactory);
injector.registerService(SIMPLE_MATH, SimpleMath);
injector.registerService(COMMON_MODULE, CommonModule);
injector.registerService(COMPLEX_DEPENDENCY_BAG, ComplexDependencyBag);
injector.registerService(COMPLEX_FACTORY, ComplexFactory);
injector.registerService(SIGNAL_FACTORY, SignalFactory);
injector.registerService(FOURIER_TRANSFORM, FftDitRecursive);
injector.registerService(DSP_MODULE, DspModule);
export default injector;