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

0.3.2 • Public • Published

anyioc

Build Status npm

Another simple ioc framework for javascript/typescript.

Install

for Node

npm install anyioc

for Browser

Use packed file dist.browser/anyioc.js.

Usage

import { ServiceProvider } from "anyioc";
const provider = new ServiceProvider();
provider.registerSingleton('the key', ioc => 102); // ioc will be scoped ServiceProvider
value = provider.get('the key'); // 102

There are some predefined key you can use direct, but you still can overwrite it:

  • ioc - get current scoped ServiceProvider instance.
  • provider - alias of ioc

Readme

Keywords

Package Sidebar

Install

npm i anyioc

Weekly Downloads

1

Version

0.3.2

License

MIT

Unpacked Size

40 kB

Total Files

8

Last publish

Collaborators

  • cologler