Skip to content

fralonra/tiniocc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tiniocc

npm version Node.js CI JavaScript Style Guide FOSSA Status

A dead simple IoC container, with lazyload support.

Installation

yarn add tiniocc

or

npm i tiniocc

Usage

// import the exported function
// you can also require it when using CommonJS
// const { createContainer } = require('tiniocc')
import { createContainer } from 'tiniocc'

// create a container
const container = createContainer()
// register a module named 'module' with plain text content 'content'
container.register('module', 'content')

// access the module via dot notation
// will print 'content'
console.log(container.module)
import { createContainer } from 'tiniocc'

const container = createContainer()
container.register('moduleA', 'content')
// register another module which depends on moduleA
container.register('moduleB', container => container.moduleA + ' content')

console.log(container.moduleA) // will print 'content'
console.log(container.moduleB) // will print 'content content'

note: when using with snowpack, you should import the module as follow:

import tiniocc from 'tiniocc'

const container = tiniocc.createContainer()

License

FOSSA Status

About

A dead simple IoC container, with lazyload support.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published