Skip to content

Commit

Permalink
add async-explicit-resource-management docs (#2760)
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed May 26, 2023
1 parent ce3d3ef commit 1a77e37
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/plugin-syntax-explicit-resource-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,19 @@ sidebar_label: syntax-explicit-resource-management
>
> It's unlikely you want to use this plugin directly as it only enables Babel to parse this syntax. Instead, use [plugin-proposal-explicit-resource-management](plugin-proposal-explicit-resource-management.md) to _both_ parse and transform this syntax.
<details>
<summary>History</summary>

| Version | Changes |
| --- | --- |
| v7.22.0 | Supports `await using` |
</details>

This plugin enables Babel to parse using declarations:

```js title="JavaScript"
using handler = await read();
await using handler = await read();
```

## Installation
Expand Down Expand Up @@ -43,3 +52,6 @@ require("@babel/core").transformSync("code", {
plugins: ["@babel/plugin-syntax-explicit-resource-management"]
});
```

## Reference
- [Proposal: ECMAScript Explicit Resource Management](https://github.com/tc39/proposal-explicit-resource-management)

0 comments on commit 1a77e37

Please sign in to comment.