anyioc
v0.3.2
Published
[![Build Status](https://travis-ci.com/Cologler/anyioc-typescript.svg?branch=master)](https://travis-ci.com/Cologler/anyioc-typescript) [![npm](https://img.shields.io/npm/v/anyioc.svg)](https://www.npmjs.com/package/anyioc) [![](https://data.jsdelivr.com/
Downloads
10
Readme
anyioc
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 ofioc