Skip to content
/ redi Public

๐Ÿ’‰ A dependency injection library for TypeScript & JavaScript, along with a binding for React.

License

Notifications You must be signed in to change notification settings

wzhudev/redi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

182 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

redi

stars downloads license coverage

redi (pronounced 'ready') is a lightweight dependency injection library for TypeScript and JavaScript, with React bindings included.

Why redi?

Feature Description
๐Ÿชถ Lightweight Zero dependencies, small bundle size
๐Ÿ”ง esbuild friendly No emitDecoratorMetadata required
๐Ÿ“ฆ Feature-rich Class, value, factory, async injection and more
โš›๏ธ React ready Built-in hooks for React integration
โœ… Well tested 100% code coverage

Quick Start

npm install @wendellhu/redi
import { Inject, Injector } from '@wendellhu/redi';

class AuthService {
  getCurrentUserInfo(): UserInfo {
    /* ... */
  }
}

class FileListService {
  constructor(@Inject(AuthService) private authService: AuthService) {}

  getUserFiles(): Promise<Files> {
    const user = this.authService.getCurrentUserInfo();
    // ...
  }
}

const injector = new Injector([[AuthService], [FileListService]]);
const fileList = injector.get(FileListService);

Getting started.

Features

Who's Using redi?

Links

License

MIT. Copyright 2021-present Wenzhao Hu.

About

๐Ÿ’‰ A dependency injection library for TypeScript & JavaScript, along with a binding for React.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages