Skip to content

Instantly share code, notes, and snippets.

@justinyoo
Created March 21, 2017 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinyoo/9319b8207c935886bea1db04d8fb350e to your computer and use it in GitHub Desktop.
Save justinyoo/9319b8207c935886bea1db04d8fb350e to your computer and use it in GitHub Desktop.
Using IoC Container in Vue.js and TypeScript App
// configs/DependencyConfigs.ts
import { Container } from "inversify";
import "reflect-metadata";
import SERVICE_IDENTIFIER from "../models/Identifiers";
import Weapon from "../interfaces/Weapon";
import Warrior from "../interfaces/Warrior";
import { Ninja } from "../models/Warrior";
import { Shuriken } from "../models/Weapon";
let container: Container = new Container();
container.bind<Warrior>(SERVICE_IDENTIFIER.WARRIOR).to(Ninja);
container.bind<Weapon>(SERVICE_IDENTIFIER.WEAPON).to(Shuriken);
export default container;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment