added example files
This commit is contained in:
23
src/view/MusicComponent.ts
Normal file
23
src/view/MusicComponent.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
|
||||
import { MusicCatalogService } from "../domain/services/MusicCatalogService"
|
||||
import { IMusicRepository } from "../domain/ports/IMusicRepository";
|
||||
|
||||
import { VinylCatalog } from "../adapters/music/VinylCatalog"
|
||||
|
||||
export class MusicComponent {
|
||||
constructor() {
|
||||
|
||||
let container = {
|
||||
IMusicRepository: () => new VinylCatalog()
|
||||
};
|
||||
|
||||
let inject = (name : string) : any => {
|
||||
if (container[name]) {
|
||||
return container[name];
|
||||
}
|
||||
throw new Error(`Failed to resolve ${name}`)
|
||||
};
|
||||
let musicCatalogService = new MusicCatalogService(inject("IMusicRepository") as IMusicRepository);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user