Created
February 10, 2019 13:02
-
-
Save Stronhold/5776455e011bb8b5db3a3c40b6d67be6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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