Skip to content

wzhudev/redi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

185 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