https://github.com/wzhudev/redi
💉 A dependency injection library for TypeScript & JavaScript, along with a binding for React.
https://github.com/wzhudev/redi
dependency-injection ioc react typescript
Last synced: about 1 year ago
JSON representation
💉 A dependency injection library for TypeScript & JavaScript, along with a binding for React.
- Host: GitHub
- URL: https://github.com/wzhudev/redi
- Owner: wzhudev
- License: mit
- Created: 2021-08-22T04:17:00.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2024-03-01T02:39:31.000Z (over 2 years ago)
- Last Synced: 2024-04-14T07:10:19.019Z (about 2 years ago)
- Topics: dependency-injection, ioc, react, typescript
- Language: TypeScript
- Homepage: https://redi.wendell.fun
- Size: 425 KB
- Stars: 77
- Watchers: 3
- Forks: 12
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# redi



[](https://codecov.io/gh/wzhudev/redi)
A dependency library for TypeScript and JavaScript, along with a binding for React.
## Overview
```typescript
import { Inject } from '@wendellhu/redi'
class AuthService {
public getCurrentUserInfo(): UserInfo {}
}
class FileListService {
constructor(@Inject(AuthService) private readonly authService: AuthService) {}
public getUserFiles(): Promise {
const currentUser = this.authService.getCurrentUserInfo()
}
}
const injector = new Injector([[AuthService], [FileListService]])
injector.get(AuthService)
```
**View full documentation on [redi.wzhu.dev](https://redi.wzhu.dev/).**
## Links
- [Demo TodoMVC](https://wzhudev.github.io/redi-todomvc/) | [source](https://github.com/wzhudev/redi-todomvc)
- [Scaffold](https://github.com/wzhudev/redi-starter)
## Users
- [Univer](https://github.com/dream-num/univer)
- Team Lark at ByteDance
## License
MIT. Copyright 2021-present Wenzhao Hu.