Skip to content

Commit

Permalink
add await using example
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Apr 30, 2023
1 parent 01a4119 commit 9b05961
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
>
> This plugin only enables Babel to parse this syntax. Babel does not support transforming 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 9b05961

Please sign in to comment.