{"id":20698962,"url":"https://github.com/doomsower/di-at-home","last_synced_at":"2026-04-21T15:02:54.895Z","repository":{"id":243840438,"uuid":"809988435","full_name":"doomsower/di-at-home","owner":"doomsower","description":"Simple dependency injection using ECMAscript decorators","archived":false,"fork":false,"pushed_at":"2024-06-12T15:58:01.000Z","size":68,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-17T19:08:48.460Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/doomsower.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-03T20:50:18.000Z","updated_at":"2024-06-22T15:56:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"792046f7-a621-459a-aa30-5e32886c086a","html_url":"https://github.com/doomsower/di-at-home","commit_stats":null,"previous_names":["doomsower/di-at-home"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doomsower%2Fdi-at-home","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doomsower%2Fdi-at-home/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doomsower%2Fdi-at-home/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/doomsower%2Fdi-at-home/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/doomsower","download_url":"https://codeload.github.com/doomsower/di-at-home/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242967686,"owners_count":20214280,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T00:27:33.543Z","updated_at":"2026-04-21T15:02:54.877Z","avatar_url":"https://github.com/doomsower.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dependency Injection at Home\n\nSimple dependency injection using typescript ECMA decorators\n\n## Usage\n\n### Simple Public Field Injection\n\n```typescript\nimport { ContainerInstance } from \"./container\";\n\nconst C = new ContainerInstance();\n\n@C.Injectable(\"door\")\nclass Door {\n  public name = \"door\";\n}\n\nclass House {\n  @C.Inject(\"door\")\n  public door!: Door;\n}\n\nconst house = new House();\nconsole.log(house.door.name); // \"door\"\n```\n\n### Singleton Injection\n\n```typescript\nconst C = new ContainerInstance();\n\n@C.Injectable(\"door\")\nclass Door {\n  private static index = 0;\n\n  constructor() {\n    Door.index += 1;\n  }\n\n  public get name(): string {\n    return `door ${Door.index}`;\n  }\n}\n\nclass House {\n  @C.Inject(\"door\")\n  public door!: Door;\n}\n\nconst house = new House();\nconsole.log(house.door.name); // \"door 1\"\n```\n\n### Transient Instances Injection\n\n```typescript\nconst C = new ContainerInstance\u003c{\n  door: [string, string];\n}\u003e();\n\n@C.Factory(\"door\")\nclass DoorFactory {\n  public produce(size: string, color: string): IDoor {\n    return { name: `${size} ${color} door` };\n  }\n}\n\nclass House {\n  @C.Transient(\"door\", \"large\", \"red\")\n  public red!: IDoor;\n\n  @C.Transient(\"door\", \"large\", \"blue\")\n  public blue!: IDoor;\n}\n\nconst house = new House();\nconsole.log(house.red.name); // \"large red door\"\nconsole.log(house.blue.name); // \"large blue door\"\n```\n\nPlease refer to the test cases in `src/container.test.ts` for more examples.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoomsower%2Fdi-at-home","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdoomsower%2Fdi-at-home","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdoomsower%2Fdi-at-home/lists"}