using-defer
Version:
41 lines (31 loc) • 498 B
Markdown
```sh
npm install using-defer
```
```ts
import { defer, asyncDefer } from "using-defer";
{
using a = defer(() => {
console.log("World");
});
using b = defer(() => {
console.log("Hello");
});
// Hello
// World
}
{
await using a = asyncDefer(async () => {
await delay(100);
console.log("World");
});
await using b = asyncDefer(async () => {
await delay(100);
console.log("Hello");
});
// Hello
// World
}
```