Giter Site home page Giter Site logo

typesoft / container-ioc Goto Github PK

View Code? Open in Web Editor NEW
99.0 7.0 25.0 145 KB

Inversion of Control container & Dependency Injection for Javascript and Node.js apps powered by Typescript.

Home Page: https://www.npmjs.com/package/container-ioc

License: MIT License

TypeScript 96.00% JavaScript 4.00%
ioc inversion-of-control dependency-injection dependency di container service-locator es6 es2015 es2017

container-ioc's People

Contributors

basedalexander avatar tolowe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

container-ioc's Issues

Error when registering with provider literal and trying to resolve via token.

`node_modules/reflect-metadata/Reflect.js:373
throw new TypeError();
^

TypeError
at Object.getOwnMetadata (/Users/thohoh/Projects/ioc/node_modules/reflect-metadata/Reflect.js:373:19)
at Container.getInjections (/Users/thohoh/Projects/ioc/dist/lib/container.js:62:24)
at Container.resolve (/Users/thohoh/Projects/ioc/dist/lib/container.js:34:33)
at Object. (/Users/thohoh/Projects/ioc/app.js:11:26)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Function.Module.runMain (module.js:605:10)
`

Inject Container within itself.

Container should be available for injections into members it contains (service locator anti pattern). Auto register container within itself when instantiating.

  • Write tests first, every member of a container should be able to inject container they're inside of. class B { constructor(@Inject(TContainer) private container: IContainer) {} }

  • create container type TContainer = Symbol('IContainer')` next to IContainer in the same file.

  • when instantiating a new container, that container instance should register itself within itself via TContainer type ( this.register({ token: TContainer, useValue: this })

  • Create an example file for typescript and javascript.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.