// Learn more at http://blog.wolksoftware.com/introducing-inversify-2 var inversify = require("inversify@2.0.0-alpha.3"); require("reflect-metadata"); var TYPES = { Ninja: "Ninja", Katana: "Katana", Shuriken: "Shuriken" }; class Katana { hit() { return "cut!"; } } class Shuriken { throw() { return "hit!"; } } class Ninja { constructor(katana, shuriken) { this._katana = katana; this._shuriken = shuriken; } fight() { return this._katana.hit(); }; sneak() { return this._shuriken.throw(); }; } // Declare injections inversify.inject(TYPES.Katana, TYPES.Shuriken)(Ninja); // Declare bindings var kernel = new inversify.Kernel(); kernel.bind(TYPES.Ninja).to(Ninja); kernel.bind(TYPES.Katana).to(Katana); kernel.bind(TYPES.Shuriken).to(Shuriken); // Resolve dependencies var ninja = kernel.get(TYPES.Ninja); return ninja;

2 comments

  • posted 7 months ago by roshanisharma
    Thanku for sharing this useful information.. I would like to share something too... Thinkwik is an expertise driven web and mobile apps Development Company helping businesses achieve their goal through robust and engaging web and mobile presence. To Build real time application, mobile app and website <a href=http://www.thinkwik.com/node-js-framework-development/>Node Js Development Company</a> <a href=http://www.thinkwik.com/android-application-development/>Android App Development</a> <a href=http://www.thinkwik.com/iphone-application-development/>iOS App Development</a>
  • posted 7 months ago by roshanisharma
    Thanku for sharing this useful information.. I would like to share something too... Thinkwik is an expertise driven web and mobile apps Development Company helping businesses achieve their goal through robust and engaging web and mobile presence. To Build real time application, mobile app and website http://www.thinkwik.com/iphone-application-development/ http://www.thinkwik.com/android-application-development/ http://www.thinkwik.com/node-js-framework-development/

sign in to comment

running