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();

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    0
  • 1.0.1
    1
  • 1.0.0
    1

Package Sidebar

Install

npm i dependy

Weekly Downloads

2

Version

1.0.2

License

MIT

Last publish

Collaborators

  • innectic