using-defer
TypeScript icon, indicating that this package has built-in type declarations

0.0.6 • Public • Published

using-defer

Install

npm install using-defer

Usage

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
}

Readme

Keywords

Package Sidebar

Install

npm i using-defer

Weekly Downloads

48

Version

0.0.6

License

none

Unpacked Size

1.47 kB

Total Files

4

Last publish

Collaborators

  • y87cgp