dependy
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Dependy

Dependy is a simple way to have fast, easy dependency injection for your project.

How simple is it? Let me show you!

Examples

import { Injectable, Injector } from "dependy";

class CoolService {

	public async connect(): Promise<boolean> {
		// TODO: Super cool connection login
		return true;
	}
}

class Core {
	constructor(private service: CoolService) {

	}

	public async start() {
		console.log("Connecting...");
		const connected = await this.service.connect();
		console.log(`Connection was ${connected ? "" : "un"}successful!`);
	}
}

const injector = new Injector(
	{
		injects: CoolService
	},
	{
		injects: Core,
		depends: [CoolService]
	}
);

injector.get(Core).start();

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i dependy

      Weekly Downloads

      1

      Version

      1.0.2

      License

      MIT

      Last publish

      Collaborators

      • innectic