Arthemis: IoC made simple.
Simple API decoupled dependency injection in which you can do IoC via containers, for more information, read the docs.
Getting Started
These instructions will get you through installing and using Arthemis on your project.
Installing
Simply install using npm or yarn
npm install --save arthemis## OR ## yarn add arthemis
docs
Using
Arthemis works as a dependency repository with automatic dependency injection, this will guide you through defining and getting stuff from the repository. First, we need to import Arthemis and create a new repository.
const arthemis = const myRepo =
Note that Arthemis exports you a function, that function gives you a new repository on every call.
const arthemis = const aRepo = const anotherRepo =
Every repository can hold it's own definers, which can vary in type:
- Literals, that will always represent the same value.
- Classes, classes definitions that can take resolved dependencies into it's constructor to return a new instance.
- Singletons, classes definitions that can take resolved dependencies to return a unique instance.
- Factories, Functions that take resolved dependencies to return a new value based on.
Defining Literals
const arthemis = const myRepo = const me = firstName: 'Artur' lastName: 'Muniz' myRepo const anotherMe = myRepo console // true
Defining Classes
const arthemis = const myRepo = { thisfirstName = 'Artur' thislastName = 'Muniz' } myRepo const me = myRepo const anotherMe = myRepo console // false
But the true power of Arthemis is inject dependencies for you.
Defining Classes with dependencies
const arthemis = const myRepo = { if level in console return consolelevel...args } { thislogger = logger } { // Use this.logger here thislogger } // Registred name does not need to be the class name myRepo // Note that 'Log' appears here, telling Arthemis that the class depends on some 'Log' myRepo const myApp = myRepo myApp // Awesome! logger was injected <3
Defining Singletons
const arthemis = const myRepo = // A simple in-memory database... myRepo myRepo
Roadmap
We organize this project roadmap using (github issues)[https://github.com/munizart/arthemis/labels/roadmap].
Questions?
If you have any questions about using Arthemis on your project, please open a (new issue)[https://github.com/munizart/arthemis/issues/new].
Filing a bug
If you found a bug, please open a (new issue)[https://github.com/munizart/arthemis/issues/new].
Contributing
This project is open for contributions. To suggest a new feature, please open a (new issue)[https://github.com/munizart/arthemis/issues/new]. To fix a filed bug or implementing a feature on (roadmap)[https://github.com/munizart/arthemis/labels/roadmap], please fork this project, create a new branch coitaining your code and send a pull request. If you need any guidence, you can reach us out by creating a new issue.
Versioning
We use SemVer for versioning. For the versions available, see the tags on this repository.
Authors
- Artur Muniz - MunizArt
See also the list of contributors who participated in this project.
License
This project is licensed under the MIT License - see the LICENSE.md file for details