Veikedo

Untitled

Apr 11th, 2016
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import * as kontainer from "kontainer";
  2. import * as ko from "knockout";
  3. import {endpoints} from "Startup/AppConfig"
  4. import {LocationService} from "ViewModels/Setup/GeoFile/data/location.service";
  5. import {SiteService} from "Components/SiteSelector/Site.service";
  6. import {HttpService, HttpServiceDecorator} from "Infrastructure/HttpService";
  7. import {ListCategoryService, ListNameService, ListValueService} from "DataAccess/CodeList/CodeListServices";
  8.  
  9.  
  10. export function registerDependencies() {
  11.     const factories = {
  12.         "HttpService": [() => new HttpServiceDecorator(new HttpService())],
  13.         "LocationService": ["HttpService", (http) => new LocationService(endpoints.location, http)],
  14.         "SiteService": ["HttpService", (http) => new SiteService(endpoints.site, http)],
  15.  
  16.         "ListCategoryService": ["HttpService", (http) => new ListCategoryService(endpoints.listCategory, http)],
  17.         "ListNameService": ["HttpService", (http) => new ListNameService(endpoints.listName, http)],
  18.         "ListValueService": ["HttpService", (http) => new ListValueService(endpoints.listValue, http)]
  19.     };
  20.  
  21.     for (let key in factories) {
  22.         if (factories.hasOwnProperty(key)) {
  23.             kontainer.registerFactory(key, factories[key]);
  24.         }
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment