Class-based API
To get the best performance, for instance when working on a library, you can avoid the overhead of creating and garbage-collecting functions by using objects in their place. Instead of passing a callback to the LazyPromise constructor, you can pass an object with a .produce method (a Producer), and instead of returning a teardown function, you can return an object with a .dispose method (a Job).