Skip to content

telanflow/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.

Resources

License

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 99.5%
  • Other 0.5%