1.0.4 • Published 7 months ago

di-lazy v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

di-lazy

Lazy instantiation of the class based on the first access to its reference

Usage

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")
1.0.4

7 months ago

1.0.3

7 months ago

1.0.2

7 months ago

1.0.1

7 months ago

1.0.0

7 months ago