Skip to content

Instantly share code, notes, and snippets.

@Stronhold
Created February 10, 2019 13:02
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 Stronhold/5776455e011bb8b5db3a3c40b6d67be6 to your computer and use it in GitHub Desktop.
Save Stronhold/5776455e011bb8b5db3a3c40b6d67be6 to your computer and use it in GitHub Desktop.
import { Injector } from "@angular/core";
import { MessageTypeEnum } from "../model/message-type.enum";
import { LogService } from "../services/log.service";
import { ErrorService } from "../services/error.service";
import { TableService } from "../services/table.service";
import { Executioner } from "../model/executioner";
export class ServiceResolver {
static getService(message: MessageTypeEnum, injector: Injector): Executioner {
switch(message){
case MessageTypeEnum.ConsoleError:
return injector.get(ErrorService);
case MessageTypeEnum.ConsoleLog:
return injector.get(LogService);
case MessageTypeEnum.ConsoleTable:
return injector.get(TableService);
}
throw Error ('Service not found');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment