react-obsidian
Version:
Dependency injection framework for React and React Native applications
12 lines (10 loc) • 371 B
text/typescript
import { modernDecorator } from './singleton.modern';
import { legacyDecorator } from './singleton.legacy';
import { shouldUseModernDecorator } from '../../utils/decorators';
export function singleton() {
return (...args: any[]) => {
return shouldUseModernDecorator(args) ?
modernDecorator(args[0]) :
legacyDecorator(args[0], args[1], args[2]);
};
}