0.0.10 • Published 10 years ago

nintrajs v0.0.10

Weekly downloads
4
License
MIT
Repository
github
Last release
10 years ago

nintrajs

Nintrajs is a dependency injection and dependency resolver framework based on the intravenous framework written by Roy Jacobs.

create a module

import {Module, Types} from 'nintrajs'
import MyService from '../MyService'

class StandardInjectionModule extends Module {

    constructor() {
        super();
    }

    initialize() {
        this._registerServices();
    }

    getBindings(){
        return super.getBindings();
    }

    _registerServices() {
        this._addBinding('MyService', MyService, Types.Singleton);
    }

    _addBinding(name,type,bindingType) {
        return super._addBinding(name,type,bindingType);
    }
}

export default StandardInjectionModule;

use the dependency resolver

import {DependencyResolver} from 'nintrajs'
import StandardInjectionModule from './injection/StandardInjectionModule'

let standardModule = new StandardInjectionModule();
DependencyResolver.initialize(standardModule)
    .then(() => {
        let myService = DependencyResolver.get('MyService');
    });
0.0.10

10 years ago

0.0.9

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago