UNPKG

smart-factory

Version:

functional programming-ready dependancy injector/ioc container library

26 lines 1.63 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const lib_1 = require("../lib"); lib_1.injectable('A', ['B'], () => __awaiter(this, void 0, void 0, function* () { return 'A'; })); lib_1.injectable('B', ['C'], () => __awaiter(this, void 0, void 0, function* () { return 'B'; })); lib_1.injectable('C', ['D'], () => __awaiter(this, void 0, void 0, function* () { return 'C'; })); lib_1.injectable('D', ['E'], () => __awaiter(this, void 0, void 0, function* () { return 'D'; })); lib_1.injectable('E', ['DEP_B'], () => __awaiter(this, void 0, void 0, function* () { return 'E'; })); lib_1.injectable('DEP_A', [], () => __awaiter(this, void 0, void 0, function* () { return 'DEP_A'; })); lib_1.injectable('DEP_B', ['DEP_A'], () => __awaiter(this, void 0, void 0, function* () { return 'DEP_B'; })); (() => __awaiter(this, void 0, void 0, function* () { yield lib_1.init({ debug: true }); const a = yield lib_1.resolve('C'); console.log(a); }))(); //# sourceMappingURL=index.js.map