{"id":16611070,"url":"https://github.com/shalldie/iocoo","last_synced_at":"2025-10-30T19:39:12.229Z","repository":{"id":57686898,"uuid":"90896584","full_name":"shalldie/iocoo","owner":"shalldie","description":"IOC library in OOP. 为 OOP 设计的 IOC 库。","archived":false,"fork":false,"pushed_at":"2022-03-25T08:39:05.000Z","size":442,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-18T11:06:08.265Z","etag":null,"topics":["di","ioc","oop"],"latest_commit_sha":null,"homepage":"","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/shalldie.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}},"created_at":"2017-05-10T18:34:13.000Z","updated_at":"2022-03-25T09:49:51.000Z","dependencies_parsed_at":"2022-09-14T07:12:17.051Z","dependency_job_id":null,"html_url":"https://github.com/shalldie/iocoo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shalldie%2Fiocoo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shalldie%2Fiocoo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shalldie%2Fiocoo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shalldie%2Fiocoo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shalldie","download_url":"https://codeload.github.com/shalldie/iocoo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242901144,"owners_count":20203898,"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":["di","ioc","oop"],"created_at":"2024-10-12T01:34:37.945Z","updated_at":"2025-10-30T19:39:07.177Z","avatar_url":"https://github.com/shalldie.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# iocoo\n\nIOC library in OOP. 为 OOP 设计的 IOC 库。\n\n[![npm][iocoo-icon]][iocoo-npm]\n[![test status](https://img.shields.io/github/workflow/status/shalldie/iocoo/ci?label=test\u0026logo=github\u0026style=flat-square)](https://github.com/shalldie/iocoo/actions)\n[![license](https://img.shields.io/npm/l/iocoo?logo=github\u0026style=flat-square)](https://github.com/shalldie/iocoo)\n\n## Installation\n\n[reflect-metadata](https://www.npmjs.com/package/reflect-metadata) is required.\n\n    npm install iocoo reflect-metadata --save\n\n## Usage \u0026 Example\n\n```ts\nimport 'reflect-metadata';\nimport { Inject, Injectable, getInstance } from 'iocoo';\n\n@Injectable({ singleton: true })\nclass Child {\n    @Inject()\n    public child!: Child;\n}\n\n@Injectable({ singleton: false })\nclass Child2 {\n    @Inject()\n    public child2!: Child2;\n}\n\n@Injectable()\nclass Person {\n    @Inject()\n    public child!: Child;\n\n    @Inject()\n    public child2!: Child2;\n}\n\n// getInstance may return the instance of a class\nconst p = getInstance(Person);\n\n// child is singleton\nexpect(p.child).toBe(p.child.child);\n\n// child2 is not\nexpect(p.child2).not.toBe(p.child2.child2);\n```\n\n## License\n\nMIT\n\n\u003c!-- iocoo --\u003e\n\n[iocoo-icon]: https://img.shields.io/npm/v/iocoo.svg?logo=npm\u0026style=flat-square\n[iocoo-npm]: https://www.npmjs.com/package/iocoo\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshalldie%2Fiocoo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshalldie%2Fiocoo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshalldie%2Fiocoo/lists"}