Creates multiple disposable resources and returns them as an array in the same order.
It is similar to uses, but returns the created instances array.
If any creator throws, already created resources are disposed in reverse order and the error is rethrown.
Example
const [r1, r2] = Disposable.create( () =>createResource1(), (r1) =>createResource2(r1), ); // use r1, r2 and dispose them later when appropriate r2.dispose(); r1.dispose();
Creates multiple disposable resources and returns them as an array in the same order. It is similar to
uses
, but returns the created instances array. If any creator throws, already created resources are disposed in reverse order and the error is rethrown.Example