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

0.0.14 • Public • Published

Typescript Container (IOC)

Laravel's famous illuminate/container ported to typescript

Build Status NPM Version Downloads Stats

This is a small attempt to bring Laravel's IoC container (illuminate/container) to typescript with the help of decorators.
NOTE: this module is not compatible with ES (Babel) alone, the reason for that, ES doesn't support parameter decorator.

Installation

npm i --save typescript-container

Known issues / Not working

  • Since stand-alone function doesn't support parameter decorators, Injecting dependencies on function doesn't work.
  • Primitive types as dependency
  • callback supports

Basic Usage

You can start by requiring the ioc container then do your thing.

src/index.ts:

index
src/Pokemon.ts:

pokemon
src/Character.ts:

character
src/Map.ts:

map
src/Monster.ts:

monster

injecting dependencies to any other method (other than constructor) also works.

Release History

  • 0.0.14
    • Override constructor parameter support
    • added tagging feature
    • cleanup package (only include /dist folder, package.json and LICENSE)
    • removed babel from project
  • 0.0.7
    • arbitrary binding support
    • arbitrary value store support
    • flush() added
    • declaration file (d.ts) added
  • 0.0.3
    • added factory() and singleton()
    • basic contextual binding added
    • basic functionality

Meta

Jacob Baring – @yakovmeisterso@tfwno.gf

Distributed under the MIT license. See LICENSE for more information.

https://github.com/yakovmeister/

Contributing

  1. Fork it (https://github.com/yakovmeister/typescript-container/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

Package Sidebar

Install

npm i typescript-container

Weekly Downloads

14

Version

0.0.14

License

MIT

Unpacked Size

17.5 kB

Total Files

18

Last publish

Collaborators

  • yakovmeister