README
SIOCC-TS
Simple IOC Container for TypeScript
This is an IOC container made specifically for TypeScript.
Usage
The simple instructions for installint the Simple IOC Container for TypeScript
Install the npm-package.
npm install siocc-ts --save-dev
Include the TypeScript definition file in your solution.
Add javascript file to your bundle using grunt, bower, etc.
Keep in mind this is an ECMASCRIPT6 file so you will need babeljs if you don't want ECMASCRIPT6.
Also this library uses strict javascript...
Profit
Example
You declare the application like this:
class Application extends ioc.ApplicationContext {
constructor() { super(); }
public register(container: ioc.Container): void {
// Register Instances
container.registerSingleton<TypeName>(TypeName)
.setInstantiateFunc(() => new instance(param...)) // (optional) Set an alternitive Instantiations function
.setResolveFunc(instance => instance // (optional) Set a method to call directly after Resolve
.someFunc()
.addSomething(new Something()));
this.initiate(container);
}
public initiate(container: ioc.Container): void {
// App initiation logic here ---
}
}
window.onload = () => new Application();
And you resolve instances like this:
ioc.Container.getCuttent().resolve(TypeName);
Contribute
Go to github.com/MarvinBrouwer/SIOCC-TS and clone the repo.
Credits
None yet.