https://github.com/tripolskypetr/di-lazy
Lazy instantiation of the class based on the first access to its reference
https://github.com/tripolskypetr/di-lazy
dependency-injection grpc lazy-loading oop optimization optimization-algorithms performance
Last synced: 4 months ago
JSON representation
Lazy instantiation of the class based on the first access to its reference
- Host: GitHub
- URL: https://github.com/tripolskypetr/di-lazy
- Owner: tripolskypetr
- License: mit
- Created: 2024-12-03T17:24:02.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2024-12-04T12:10:32.000Z (10 months ago)
- Last Synced: 2025-03-26T05:25:12.418Z (7 months ago)
- Topics: dependency-injection, grpc, lazy-loading, oop, optimization, optimization-algorithms, performance
- Language: TypeScript
- Homepage: https://github.com/react-declarative/react-declarative
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# di-lazy
> Lazy instantiation of the class based on the first access to its reference
## Usage
```tsx
const LazyClass = lazy(class {
constructor(...args: number[]) {
console.log("CTOR", { args })
}
test = () => console.log("test");
}, "test");const lazyInstance = new LazyClass(1, 2, 3);
console.log("Instance created");
lazyInstance.test(); // CTOR { args: [ 1, 2, 3 ] }
console.log("Method executed")
```