Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: 9 days ago
JSON representation

💉 A dependency injection library for TypeScript & JavaScript, along with a binding for React.

Awesome Lists containing this project

README

        

# redi

![Stars](https://badgen.net/github/stars/wzhudev/redi)
![Downloads](https://badgen.net/npm/dt/@wendellhu/redi)
![License](https://badgen.net/github/license/wzhudev/redi)
[![Codecov](https://img.shields.io/codecov/c/github/wzhudev/redi.svg)](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.wendell.fun](https://redi.wendell.fun/).**

## Links

- [Demo TodoMVC](https://wzhudev.github.io/redi-todomvc/) | [source](https://github.com/wzhudev/redi-todomvc)
- [Doc site](https://redi.wendell.fun) | [source](https://github.com/wzhudev/redi-site)
- [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.