UNPKG

ts-ioc-container

Version:

Fast, lightweight TypeScript dependency injection container with a clean API, scoped lifecycles, decorators, tokens, hooks, lazy injection, customizable providers, and no global container objects.

72 lines (71 loc) 2.35 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EmptyContainer = void 0; const MethodNotImplementedError_1 = require("../errors/MethodNotImplementedError"); const DependencyNotFoundError_1 = require("../errors/DependencyNotFoundError"); const ContainerNotFoundError_1 = require("../errors/ContainerNotFoundError"); class EmptyContainer { get isDisposed() { throw new MethodNotImplementedError_1.MethodNotImplementedError(); } addInstance(instance) { } getParent() { return undefined; } getScopes() { return []; } getScopeByInstanceOrFail(instance) { throw new ContainerNotFoundError_1.ContainerNotFoundError('Cannot find scope for the given instance'); } getInstances() { return []; } hasInstance(instance) { return false; } createScope() { throw new MethodNotImplementedError_1.MethodNotImplementedError(); } dispose() { throw new MethodNotImplementedError_1.MethodNotImplementedError(); } register(key, value) { throw new MethodNotImplementedError_1.MethodNotImplementedError(); } hasTag(tag) { throw new MethodNotImplementedError_1.MethodNotImplementedError(); } addTags(...tags) { throw new MethodNotImplementedError_1.MethodNotImplementedError(); } getRegistrations() { return []; } hasRegistration(key) { return false; } removeScope() { } useModule(module) { throw new MethodNotImplementedError_1.MethodNotImplementedError(); } addRegistration(registration) { throw new MethodNotImplementedError_1.MethodNotImplementedError(); } resolve(key, options) { throw new DependencyNotFoundError_1.DependencyNotFoundError(`Cannot find ${key.toString()}`); } resolveByAlias(alias, options) { return []; } resolveOneByAlias(alias, options) { throw new DependencyNotFoundError_1.DependencyNotFoundError(`Cannot find alias ${alias.toString()}`); } addOnDisposeHook(...hooks) { throw new MethodNotImplementedError_1.MethodNotImplementedError(); } addOnConstructHook(...hooks) { throw new MethodNotImplementedError_1.MethodNotImplementedError(); } } exports.EmptyContainer = EmptyContainer;